What do you want to save?
Add Code snippet
New code examples
-
TypeScript 2021-11-22 13:54:56
react typescript dynamically set key state
// the snackBarState is a string which would represent the key name in the state object // i think this is a better way as opposed to doing a {...this.state, ['key]: value} // equivalent. // Will test this later on which is better. But for now if anyone ... Add solution -
Javascript 2021-11-21 16:55:18
javascript if browser out of focus
var hidden, visibilityChange; if (typeof document.hidden !== "undefined") { // Opera 12.10 and Firefox 18 and later support hidden = "hidden"; visibilityChange = "visibilitychange"; } else if (typeof document.msHidden !==... Add solution -
Javascript 2021-11-19 08:02:19
javascript hash string
/** * Calculate a 32 bit FNV-1a hash * Found here: https://gist.github.com/vaiorabbit/5657561 * Ref.: http://isthe.com/chongo/tech/comp/fnv/ * * @param {string} str the input value * @param {boolean} [asString=false] set to true to return the hash v... Add solution -
Javascript 2021-11-17 19:23:20
either function monad in javascript
class Monad { // pure :: a -> M a pure = () => { throw "pure method needs to be implemented" } // flatMap :: # M a -> (a -> M b) -> M b flatMap = (x) => { throw "flatMap method needs to be implemented" } ... Add solution -
Javascript 2021-11-16 01:55:18
strict equality
//Strict equality operator console.log(1 === 1); // expected output: true console.log('hello' === 'hello'); // expected output: true console.log('1' === 1); // expected output: false console.log(0 === false); // expected output: false //Comparing o... Add solution
Best helpers
Ranking is empty