samimwebdev

Operator and miscellaneous (3)

Dec 6th, 2021 (edited)
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // let x = 10
  2.  
  3. //shortcut
  4. //x = x + 1 x = x / 2 / x++ x--
  5. // x /= 2
  6. // x %= 2
  7.  
  8. //operands++
  9. //+ operands
  10.  
  11. // console.log(--x)
  12. // console.log(x)
  13.  
  14. // console.log(++x)
  15. // console.log(x)
  16.  
  17. //comparison
  18. console.log(1 == Number('1')) //only consider value
  19. console.log(1 === '1') //consider both value and type
  20.  
  21. //conversion (explicit)
  22. //coercion(implicit conversion)
  23.  
  24. // concatenation (+)
  25.  
  26. //if any of the part  is string , convert other part to string
  27. // console.log(1 + 'Hello')
  28. // //else(- * / %) javascript try it's to calculate the result
  29. // //if possible you will get number
  30. // console.log('10' * true)
  31. // //or not Possible -NaN
  32. // console.log(1 * 'Hello') //NaN
  33.  
  34. //operator precedence and associativity
  35. // console.log(2 * (2 * 3))
  36.  
  37. //object({}, [], null)
  38. //Array
  39. // console.log(Array.isArray({}))
  40. // //compare null === null , undefined == null
  41.  
  42. // //number(10, NaN)
  43. // console.log(Number.isNaN(Number('ggjgb')))
  44.  
  45. //undefined vs null
  46. // let z;
  47. // console.log(z)
  48.  
  49. // let bogus = null
  50. // console.log(bogus === null )
  51.  
  52. // Freecodecamp
  53. //Approach
  54. //understanding the problem but don't know how to code (hint)
  55. //Not understanding the problem(support)
  56. //successful - Hint(For Different approach)
  57.  
Add Comment
Please, Sign In to add comment