- http://stackoverflow.com/questions/804115  (rebasevsmerge).
- https://www.atlassian.com/git/tutorials/merging-vs-rebasing (rebasevsmerge)
- https://www.atlassian.com/git/tutorials/undoing-changes/ (resetvscheckoutvsrevert)
- http://stackoverflow.com/questions/2221658 (HEAD^ vs HEAD~) (See git rev-parse)
- http://stackoverflow.com/questions/292357 (pullvsfetch)
- http://stackoverflow.com/questions/39651 (stashvsbranch)
- http://stackoverflow.com/questions/8358035 (resetvscheckoutvsrevert)
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // Using !! operator easily convert value in boolean | |
| console. log ('This is not Empty: ', !!'') // This is not Empty: false | |
| console. log ('This is not Empty: ', !!'Data') // This is not Empty: true | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | let data = undefined ?? 'noData' | |
| console.log(data) // noData | |
| data = null ?? 'noData' | |
| console.log(data) // noData | |
| data = '' ?? 'noData' | |
| console.log(data) // '' | |
| data = 0 ?? null ?? 'noData' | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // we can convert number to string using '+' operator | |
| const personNo = '238932' | |
| console.log('personNo: ', +personNo, 'typeOf: ', typeof +personNo) | |
| // we can concert string to number using + operator followed by empty string '' | |
| const personId = 324743 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | const fruitList = ['apple', 'mango'] | |
| console.log(typeof fruitList) // object | |
| console.log(Array.isArray(fruitList)) // true | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // we can remove duplicate values using 'Set' | |
| const fruitList = ['apple', 'mango', 'apple', 'grapes'] | |
| const uniqFruitList = [...new Set(fruitList)] | |
| console.log(fruitList) // ['apple', 'mango', 'grapes'] | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // wen can use 'Boolean' methodto test truthy values | |
| const fruitList = ['apple', null 'mango', undefined, ''] | |
| // filter falsy values | |
| const filterFruitList = fruitList.filter(Boolean) | |
| console.log(filterFruitList) // ['apple', 'mango'] | |
| // check if any truthy value is in array | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // we access both key and value usign object entries method | |
| const data = {id: 1, name: 'Laptop', isSale: true} | |
| Object.entries(data).forEach(([key, value]) => { | |
| if (['id', 'name']).includes(key)) { | |
| console.log('key: ', key, 'value: ', value) | |
| } | |
| }) | |
| // key: id value: 1 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // we can also give alias name of variable when destructuring | |
| const productData = {id: 23, name: 'Laptop'} | |
| const {name: deviceName} = productData | |
| console.log('deviceName', deviceName) // deviceName Laptop | |
| // here destructuring value with dynamic key | |
| const extractKey = 'name' | |
| const { [extractKey]: data } = productData | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // we can use 'in' keyword to check property exists in object | |
| const person = { | |
| id: 'ab32', | |
| name : 'Krina' | |
| } | |
| console.log('name' in person) // true | |
| console.log('isActive' in person) // false | 
NewerOlder