What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-01-27 23:45:36
foreach over array javascript
/** 1. Use forEach and related */ var a = ["a", "b", "c"]; a.forEach(function(entry) { console.log(entry); }); /** 2. Use a simple for loop */ var index; var a = ["a", "b", "c"]; for (index ... Add solution -
Javascript 2021-10-28 09:03:15
js object clear
// for enumerable and non-enumerable of an object with proto chain var props = Object.getOwnPropertyNames(obj); for (var i = 0; i < props.length; i++) { delete obj[props[i]]; } // for enumerable properties of shallow/plain object for (var key in obj... Add solution -
Other 2021-10-27 20:43:09
mongodb copy indexes from a server to another
db.getCollectionNames().forEach(function(collection) { indexes = db[collection].getIndexes(); indexes.forEach(function (c) { opt = '' ixkey = JSON.stringify(c.key, null, 1).replace(/(\r\n|\n|\r)/gm,"") ns = c.ns.substr(c.ns.indexOf("."... Add solution -
Javascript 2021-10-11 14:15:05
how to dynamically populate pdf with pdfmake node
// playground requires you to assign document definition to a variable called dd var headers = { fila_0:{ col_1:{ text: 'Faltas', style: 'tableHeader',rowSpan: 2, alignment: 'center',margin: [0, 8, 0, 0] }, col_2:{ text: 'Fecha', styl... Add solution -
Javascript 2021-10-08 21:29:07
javascript loop through object values
var p = { "p1": "value1", "p2": "value2", "p3": "value3" }; // for-in for (var key in p) { if (p.hasOwnProperty(key)) { console.log(key + " -> " + p[key]); ... Add solution -
Javascript 2021-10-04 17:11:03
key value json javascript
var jsonArray = '{"required":1, "minlength":2}' var jsonParsedArray = JSON.parse(jsonArray); for (key in jsonParsedArray) { if (jsonParsedArray.hasOwnProperty(key)) { console.log("%c "+key + " = " + jsonPars... Add solution -
Javascript 2021-09-20 03:46:03
javascript check if two arrays of objects have same elements
var isEqual = function (value, other) { // Get the value type var type = Object.prototype.toString.call(value); // If the two objects are not the same type, return false if (type !== Object.prototype.toString.call(other)) return false; // If items... Add solution
Best helpers
Ranking is empty