https://github.com/munaimpro/programming-hero-assignment-5
Programming Hero Assignment 5 - Module 30
https://github.com/munaimpro/programming-hero-assignment-5
Last synced: 3 months ago
JSON representation
Programming Hero Assignment 5 - Module 30
- Host: GitHub
- URL: https://github.com/munaimpro/programming-hero-assignment-5
- Owner: munaimpro
- Created: 2026-03-06T14:49:04.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-03-07T07:31:18.000Z (4 months ago)
- Last Synced: 2026-03-07T14:15:15.347Z (4 months ago)
- Language: HTML
- Size: 219 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# programming-hero-assignment-5
Programming Hero Assignment 5 - Module 30
## Q1 - What is the difference between var, let, and const?
Ans - var is function-scoped, redeclarable, and reassigned and hoisted, let is bolck-scoped, and reassignable, but can not be redeclared in the same scope, const is also block-scoped, but does not allow reassignment and redeclare and const need to be initialized when declared.
## Q2 - What is the spread operator (...)?
Ans - Spread operator expands any array, object or strings to individual elements. It is an ES6 feature, that can copy an array, or objects elements and make a new array or object by merging the copied element with the concated array or object.
## Q3 - What is the difference between map(), filter(), and forEach()?
Ans - map() is used to make a new array by applying a function to each element of the old array or object one-by-one, filter() is used to filter elements of an array or object by matching specific condition(s) and creates a new array or object, and forEach() is used to loop through the elements of an object or an array.
## Q4 - What is an arrow function?
Ans - The arrow function is a shortcut to the traditional function. They allow to write function without using the "function" keyword. Instead it uses the => sign. There are no need to use curly braces - {} if there are only single line in the function body, and no need to use return keyword, unless using curly braces. Because the arrow function returns automatically.
## Q5 - What are template literals?
Ans - Template literals are JavaScript string literals that allow to write multi line string within the single backtick `` and also allow to write expressions directly within the string and automatically concatenate them without using any concatenation operators.