My Sites


Thursday, April 7, 2016

JavaScript Best Practices

The latest ECMAScript standard defines 7 data types:
  • Six data types that are primitives:
    • Boolean
    • Null
    • Undefined
    • Number
    • String
    • Symbol (new in ECMAScript 6)
  • and Object
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures

best way to check something is available
if(typeof x !== 'undefined'){
    console.log('Exists');
}else{
    console.log('Not Exists');
}

Equality
==   If variables are 2 diffrent types , it will convet them to the same type and check
=== There will be no type conversion

Use === as default.

Node.js ENV variable
Use  node-foremon or nodemon

No comments:

Post a Comment