Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am teamertibebu on github.
  • I am teamertibebu (https://keybase.io/teamertibebu) on keybase.
  • I have a public key ASDBMgPiUwJsWgnARr6AGHhmFx0yZCi-Zcv0JhPtIr8jygo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am teamertibebu on github.
  • I am teamertibebu (https://keybase.io/teamertibebu) on keybase.
  • I have a public key ASAIesulJk2k7Uz5s9D0uhjSqzf33Yn1I7eRFM1aHgyA4Ao

To claim this, I am signing this object:

var map = new Map()
map.set('p', 'o')
map.set('n', 'y')
map.set('f', 'o')
map.set('o', '!')
console.log([...map]) // <- [['p', 'o'], ['n', 'y'], ['f', 'o'], ['o', '!']]
let mapObject = new Map([["Batman", 1], [2, "Superman"], [3, "Flash"]]);
mapObject.forEach((value, key) => {
console.log(key + "," + value);
});
// Output ->
//Batman,1
//2,Superman
//3,Flash
let mapObject = new Map([["Batman", 1], [2, "Superman"], [3, "Flash"]]);
for(let entry of mapObject.entries()) {
console.log(entry); //[ 'Batman', 1 ], [ 2, 'Superman' ], [ 3, 'Flash' ]
}
//OR
for(let entry of mapObject){
console.log(entry); // [ 'Batman', 1 ], [ 2, 'Superman' ], [ 3, 'Flash' ]
let mapObject = new Map([["Batman", 1], [2, "Superman"], [3, "Flash"]]);
for(let value of mapObject.values()) {
console.log(value); //1, "Superman", "Flash"
}
const [count, setCount] = useState(0);
const [value, setValue] = useState(0);
useEffect(() => {
document.title = `You clicked ${count} times`;
}, [count]);
useEffect(() => {
document.title = `You clicked ${count} times`;
}, []);
import React, { useEffect } from 'react';
const App = () => {
const [count, setCount] = useState(0);
useEffect(() => {
document.title = `You clicked ${count} times`;
});
return (
import React from 'react';
const App = () => {
const [count, setCount] = useState(0);
return (
<div>
<p>`You clicked {count} times.</p>
<button onClick={() => setCount(count + 1)}>"Click Me"</button>
</div>