#javascript
Read more stories on Hashnode
Articles with this tag
A few days back while I was working I wrote a long block of code that made use of map, reduce & filter. Without testing I finished the code assuming...
const asyncFunction = async () => "HELLO"; const main = async () => { const value = asyncFunction(); console.log(value === "HELLO" ? "true" :...
const pick = (obj = {}, keys = []) => { const result = {}; for (const key in obj) { if (keys.includes(key)) { result[key] = obj[key]; ...
const getDayNameOrNo = (value) => { const mappings = [ [0, "sunday"], [1, "monday"], [2, "tuesday"], [3, "wednesday"], [4,...
db.getCollection("posts") .find({}) .forEach((item) => { const newValues = item.resources ? item.resources.map((label) => ({ label })) ...
const repeatFn = (n, fn) => { const results = []; for (let i = 0; i < n; i++) { results.push(fn()); } return results; }; const result =...