Tagged: javascript


Currying in javascript

Problem Implement the compound function which returns a function and satisfies the following condition function add10 (a) { return a + 10 } console.log(add10(10)) // 20 console.log(compound(add10)(10)) // 30 Understanding closures, currying, partially applied...


hex to rgba conversion using javascript

Algorithm get two characters from the input string at a time and convert it to the integer For example let hex = ‘ff00ff’; let r = parseInt(hex.substring(0, 2), 16) // 255 concat all the...


Format the given number into an American currency format

Convert a given number into the formatted number. Logic Traverse the┬ástring in the reverse order Consider the following cases : Positive numbers, Negative numbers, Positive floating point numbers, Negative floating point numbers   Solution