Ans:
- var can change value, is function scoped, and you can use it before declaring (hoisting).
- let can change value, is block scoped, and cannot be used before declaring.
- const cannot change value, is block scoped, and cannot be used before declaring.
Ans:
- Spread operator ... is used to copy items from an array or object. It can also be used to combine arrays or objects into a new one. It helps to avoid changing the original array or object.
Ans:
- forEach() goes through each item but does not return anything.
- map() goes through each item and makes a new array with changed values.
- filter() goes through each item and makes a new array with only items that pass a test.
Ans:
- Arrow function is a short way to write a function in JS. It uses => and is cleaner than the regular function keyword. It also keeps this value from outside the function.
Ans:
- Template literals are strings written with backticks ```` instead of quotes. They allow embedding expressions using ${} inside the string. They also support multi-line strings without extra characters.