-
Notifications
You must be signed in to change notification settings - Fork 172
Open
Description
Global Declaration: Global Scope
"In JavaScript, variables can be declared without using any operators"
The above statement is correct saying only about the "non-strict" mode. In the strict mode "use strict" would cause a ReferenceError.
Declaration with let: Block Scope
function scope3(print) {
if(print) {
let insideIf = '12';
}
console.log(insideIf)
}
scope3(true);In the snippet above there would be a ReferenceError because as the title says let (and const) are Block Scoped variables.
Truthy/Falsy Check
"Here are commonly used expressions that evaluate to true:"
- true
- Any number other than 0
- Non-empty strings
- Non-empty object
Objects in JavaScript even if it's empty will always give the truthy result. Hence the last statement in the list is not correct.
I suppose it would be better to say:object (any object)
Metadata
Metadata
Assignees
Labels
No labels