What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-03-16 16:30:04
get all from dir node
//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 -
Other 2022-03-13 06:15:16
1. Given a phrase, count the occurrences of each word in that phrase.
function count(str) { var obj = {}; str.split(" ").forEach(function(el, i, arr) { obj[el] = obj[el] ? ++obj[el] : 1; }); return obj; } console.log(count("olly olly in come free")); Add solution -
Javascript 2022-03-11 05:30:33
javascript for group object properties based on another property
var list = [ { date: "2017-01-01", type: "type1", amount: 100 }, { date: "2017-01-01", type: "type2", amount: 150 }, { date: "2017-01-02",... Add solution -
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