What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-10-10 12:44:10
cypress read xml file
describe('Sitemap', () => { // initialize the url array let urls = [] // be sure to get the url list before executing any tests before(async () => { // getch the sitemap content const response = await cy.request('sitemap.xml') ... Add solution -
TypeScript 2021-10-10 07:10:04
group objects in javascript
function groupBy(arr, prop) { const map = new Map(Array.from(arr, obj => [obj[prop], []])); arr.forEach(obj => map.get(obj[prop]).push(obj)); return Array.from(map.values()); } const data = [{ name: "Display", group: "Tec... Add solution -
Java 2021-10-10 04:40:08
java zoneddatetime
LocalDateTime now = LocalDateTime.now(); System.out.println(now); System.out.println("ZoneId.systemDefault(): " + ZoneId.systemDefault()); // convert LocalDateTime to ZonedDateTime, with default system zone id ZonedDateTime zonedDateTime = now.... Add solution -
Javascript 2021-10-10 04:33:13
reverse key and value in object js
//The concise way by using ES6 syntax like this. const obj = {A : 1, B : 2, C : 3, D : 4} function objectFlip(obj) { return Object.entries(obj).reduce((acc, [key, value]) => (acc[value] = key, acc), {}) } console.log('input: ',obj); console.lo... Add solution -
Javascript 2021-10-09 23:47:03
loop over an array
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 -
Javascript 2021-10-09 18:33:03
Iterate Through an Array with a For Loop
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