What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-02-28 14:40:05
node list files in directory
//requiring path and fs modules const path = require('path'); const fs = require('fs'); //joining path of directory const directoryPath = path.join(__dirname, 'Documents'); //passsing directoryPath and callback function fs.readdir(directoryPath, functio... Add solution -
Javascript 2022-02-27 15:50:05
js foreach querySelectorAll
const allSpanElements = document.querySelectorAll('span'); allSpanElements.forEach((spanElement) => { // Here comes the Code that should be executed on every Element, e.g. spanElement.innerHTML = "This Content will appear on every span Elemen... Add solution -
TypeScript 2022-02-25 03:20:10
How to loop through objects in java using streams
ArrayList<String> namesList = new ArrayList<String>(Arrays.asList( "alex", "brian", "charles") ); namesList.forEach(name -> System.out.println(name)); Add solution -
Javascript 2022-02-22 21:25:11
iterate over node object children
/* HTML */ /* <ul class="navigation__secondary" id="navigation-bar"> <li class="navigation__secondary-item"> <span>Item</span> </li> <li class="navigation__secondary-item active&... Add solution -
Javascript 2022-02-20 05:25:10
javascript max characters string function
const getMaxLetter = (str) => { let max = 0; let maxChar = ''; str.split('').forEach((char) => { if (str.split(char).length > max) { max = str.split(char).length - 1; maxChar = char; } }); return `The max letter is :... Add solution -
Javascript 2022-02-17 18:40:44
loop array of objects
/* new options with IE6: loop through array of objects */ const people = [ {id: 100, name: 'Vikash'}, {id: 101, name: 'Sugam'}, {id: 102, name: 'Ashish'} ]; // using for of for (let persone of people) { console.log(persone.id + ': ' + persone.na... Add solution -
Javascript 2022-02-16 18:35:08
loop through an array in js
var data = [1, 2, 3, 4, 5, 6]; // traditional for loop for(let i=0; i<=data.length; i++) { console.log(data[i]) // 1 2 3 4 5 6 } // using for...of for(let i of data) { console.log(i) // 1 2 3 4 5 6 } // using for...in for(let i in data) { con... Add solution