DEV Community

Discussion on: Javascript Shorthand Coding Techniques

Collapse
 
getanwar profile image
Anwar Hussain

For #1: if(isGirl) is not a shorthand for if(isGirl === true) because the first condition will always pass if the value is truthy whereas later will only pass if the value is boolean true.

For #3: Arrow function is not a shorthand for the traditional function. Because arrow functions are lexical meaning this inside an arrow function will only have lexical scope. So it can not be bind, call or applied against another context.

For #12 and #15 see this commented

Collapse
 
kostagon profile image
Kosta Goncharov

Also, the arrow function in this case isn't hoisting,
function expressions (aka the longhand) will hoist.