Useful LeetCode Library

Convert an integer into an array of digits: var getDigitsArray = function(num){ if(num === 0) return [0]; var arr = []; while(num > 0){ var digit = nu ... ...

JavaScript里没有Associative Array

很多年来,我一直以为JavaScript里有Associative Array,而我也一直以为我每天在用的Associative Array,其实也只是Sugar Syntax. var arr; arr['a'] = 'apple'; arr['b'] = 'banana'; 其实它是一个Obje ... ...

Update SQL Table using CASE and WHEN

Given a table salary, such as the one below, that has m=male and f=female values. Swap all f and m values (i.e., change all f values to m and vice ver ... ...

React SSR with Isomorphic-css-loader

Index.js: import App from './app'; import React from 'react'; import ReactDOM from 'react-dom'; import { renderToString } from "react-dom/server& ... ...

React Ref

Ref is just a way to manipulate the DOM just in a similar manner as jQuery. Simple example: import React from "react"; import ReactDOM from ... ...

React Context API

Simple example: import React from "react"; import ReactDOM from "react-dom"; const MyContext = React.createContext(); const MyProv ... ...