Skip to content

Instantly share code, notes, and snippets.

@insaurabh
Created March 20, 2019 05:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save insaurabh/965f000c9e3975cbf38e1ea042f798eb to your computer and use it in GitHub Desktop.
Save insaurabh/965f000c9e3975cbf38e1ea042f798eb to your computer and use it in GitHub Desktop.
map in js
<div id="root">Hi</div>
console.log('================= MAP ===================');
const numbers = [1,2,3,4,6];
console.log(numbers)
const newNumber = numbers.map((number) => {
console.log(number);
return number*2;
});
console.log(newNumber);
console.log(numbers);
let root = document.querySelector('#root');
let spitIt = `
<b>newNumber </b> ${newNumber}
<br/>
and <b>old nubers</b> list is ${numbers}
`;
root.innerHTML = spitIt;
console.log('================= MAP ENDS ===================');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment