Skip to content

Green Earth || Green Earth is a tree-planting initiative web app designed to inspire users to contribute to a greener planet. The site lets users explore different tree categories, view details, and add trees to their cart for planting support. Built with a clean UI and eco-friendly theme, this project promotes environmental awareness and makes it

Notifications You must be signed in to change notification settings

roufrubelbd/assignment-06

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README file to answer the following question

  1. What is the difference between var, let, and const? Ans: var : function-scoped, re-declarable.
    let : block-scoped, re-assignable, not re-declarable.
    const : block-scoped, cannot be re-assigned. example: var a = 10;
    let b = 20;
    const c = 30;

  2. What is the difference between map(), forEach(), and filter()? Ans: map() : returns a new array .

forEach() : loops through but returns undefined.

filter() : returns a new array with elements that match a condition. example: [1,2,3].map(x => x2);
[1,2,3].forEach(x => x
2); // returns undefined [1,2,3].filter(x => x>1);

  1. What are arrow functions in ES6? Ans: Shorter syntax for functions. example: const add = (a,b) => a+b;
    console.log(add(2,3));

  2. How does destructuring assignment work in ES6? Ans: Extracts values from arrays/objects into variables.

example: const [x,y] = [1,2];
const {name, age} = {name:"Ali", age:25};

  1. Explain template literals in ES6. How are they different from string concatenation? Ans: Use backticks (), and multi-line strings. example: const name = "Ali"; console.log(Hello, ${name}!`);

About

Green Earth || Green Earth is a tree-planting initiative web app designed to inspire users to contribute to a greener planet. The site lets users explore different tree categories, view details, and add trees to their cart for planting support. Built with a clean UI and eco-friendly theme, this project promotes environmental awareness and makes it

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published