#codenewbies
Read more stories on Hashnode
Articles with this tag
// File: useToggle.js import { useState } from "react"; const useToggle = (initialState = false) => { const [visible, setVisibility] =...
_.isEmpty(): Matches undefined, null, false & empty arrays, obj, strings const _ = require('lodash'); console.log( _.isEmpty(undefined), ...
const asyncFunction = async () => "HELLO"; const main = async () => { const value = asyncFunction(); console.log(value === "HELLO" ? "true" :...
snake_case kebab-case camelCase (JS variables, functions) PascalCase (JS Classes) SCREAMING_SNAKE_CASE (JS constants)
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,...