Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js iterate set

const mySet = new Set( [ { a: 1 }, { b: 2 } ] );

// A) Using forEach()
mySet.forEach( item => console.log( item ) );

// B) Using for ... of
for (let item of mySet) {
  console.log(item);
}
// Output:
// { a: 1 }
// { b: 2 }
Comment

javascript Iterate Sets

const set = new Set([1, 2, 3]);

// looping through Set
for (let i of set) {
    console.log(i);
}
Comment

iterate set javascript

function logSetElements(value1, value2, set) {
  console.log(`s[${value1}] = ${value2}`);
}

new Set(['foo', 'bar', undefined]).forEach(logSetElements);

// expected output: "s[foo] = foo"
// expected output: "s[bar] = bar"
// expected output: "s[undefined] = undefined"
Comment

PREVIOUS NEXT
Code Example
Javascript :: Add Text Inside Of React Component 
Javascript :: add to array applescript 
Javascript :: convert image url to base64 javascript without canvas 
Javascript :: code javascript 
Javascript :: angular singleton service example 
Javascript :: express generator error handling 
Javascript :: js get html title 
Javascript :: GET and CHANGE the class of an element 
Javascript :: forece reload without clear cache js 
Javascript :: react multiple classname 
Javascript :: github create react app buildpack 
Javascript :: how to use react-native-vector-icons 
Javascript :: react select dropdown 
Javascript :: insert a string in another js 
Javascript :: default in javascript 
Javascript :: mui link icon 
Javascript :: get all a tags javascript 
Javascript :: js replace whole word and not words within words 
Javascript :: mail testing 
Javascript :: search node in tree javascript 
Javascript :: string properties in javascript 
Javascript :: How to change height of bottom material tab navigator from react-naviagtion 
Javascript :: google map get lat long by pincode 
Javascript :: run node script from terminal 
Javascript :: Enqueuing JavaScript in WordPress 
Javascript :: js for i in html collection 
Javascript :: label animation css 
Javascript :: clear dict javascript 
Javascript :: sintax arrow function in javascript 
Javascript :: send response from iframe to parent 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =