Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One line of code creates a lot of confusing #2024

Merged
merged 1 commit into from Sep 5, 2020

Conversation

@lumosmind
Copy link
Contributor

@lumosmind lumosmind commented Jul 23, 2020

// obj.toString === obj.__proto__.toString == Object.prototype.toString

It is look like JS code but it gives different result from what we want to get.
There is different kind of equality operator and these give more confusing about what is the purpose of these?

Purpose of the line of code is showing correctness of these words.

So then when obj.toString() is called the method is taken from Object.prototype.

So, it can be better to separate this line into 2 line of code to make it sensible and readable.
Subject and code is already hard but there is no need to make readers ask unnecessary questions.

"// obj.toString === obj.__proto__.toString == Object.prototype.toString"
It is look like JS code but it gives different result from what we want to get.
There is different kind of equality operator ant these give more confusing what is the purpose of these?
It can be better to separate this line into 2 line of code to make it sensible and readable.
Subject and code is already hard but there is no need to make readers ask unnecessary questions.
@iliakan iliakan merged commit edc6126 into javascript-tutorial:master Sep 5, 2020
1 check passed
1 check passed
license/cla Contributor License Agreement is signed.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.