What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-10-13 09:43:03
js rgba to hex
function rgbToHex(r, g, b) { return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1); } function hexToRgb(hex) { var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); if(result){ var... Add solution -
Javascript 2021-10-13 07:18:07
how to define args using param discord.js
//Seperate Arguments let seperateArgs = args[0]; //0 being the first argument //Input "hello world" //Output "hello" //Full Arguments let fullArgs = args.slice(0).join(' '); //Input "hello world" //Output "hello world&q... Add solution -
-
Javascript 2021-10-12 23:17:06
js first letter to uppercase
//capitalize only the first letter of the string. function capitalizeFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1); } //capitalize all words of a string. function capitalizeWords(string) { return string.repl... Add solution -
TypeScript 2021-10-12 07:48:07
react setstate in hooks to array of objects value
const[array,setArray]= useState([ {id: 1, value: "a string", othervalue: ""}, {id: 2, value: "another string", othervalue: ""}, {id: 3, value: "a string", othervalue: ""},... Add solution -
Javascript 2021-10-11 20:42:07
permutation javascript
function getArrayMutations(arr, perms = [], len = arr.length) { if (len === 1) perms.push(arr.slice(0)) for (let i = 0; i < len; i++) { getArrayMutations(arr, perms, len - 1) len % 2 // parity dependent adjacent elements swap ? [arr... Add solution -
Other 2021-10-11 13:32:07
convert a new date standard to a yyy-mm-dd format in javascript
function convert(str) { var date = new Date(str), mnth = ("0" + (date.getMonth() + 1)).slice(-2), day = ("0" + date.getDate()).slice(-2); return [date.getFullYear(), mnth, day].join("-"); } console.log(convert(&q... Add solution