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

typeof(null) #2

Open
aprinciple opened this issue Jun 16, 2019 · 0 comments
Open

typeof(null) #2

aprinciple opened this issue Jun 16, 2019 · 0 comments

Comments

@aprinciple
Copy link

aprinciple commented Jun 16, 2019

if ( typeof(a) === 'string' && typeof(a) != null && typeof(b) != null

typeof(null) - возвращает "object". "object" не может сравниваться с null;

let answer = null;
if(answer == null) { 
  break;
}

// typeof(answer) == null - не будет работать, потому что сравниваться будет "object" == null
В последующих задачах/файлах такой же код.
Если будет задача что-то сделать при "Cancel - null" от пользователя, то такое сравнение никогда не сработает

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant