vscode Use a regular expression in VS Code's find/replace to replace && with JavaScript's optional chaining In December 2019, optional chaining went to TC39 stage 4. Here is a regular expression to replace most instances of foo && foo.bar and baz && baz() with optional chaining.
javascript this in functions, arrow functions, class methods, and class arrow function properties Functions & Class Methods both bind this when/how/where they are called. it is sometimes called dynamic binding Arrow Function & Arrow Function Class Properties both bind this when/how/where they
javascript Simple Fetch API Example let request = new Request('https://localhost:5001/api/values'); fetch(request) .then((response) => response.json()) .then((json) => console.log(json)); https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
javascript Simple Example of Using the Browser's History API This little History API demo hooks in to the browser button. We ran it using the the Firefox Developer Console. The demo does three things: Adds an onpopstate = (e) => console.log(e.
nodejs import m = require("m") vs import * as m from "m" Image by Varsha Y S (Own work) [CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0)], via Wikimedia Commons If you think you understand quantum mechanics, you don't understand quantum mechanics.
nodejs Copy to clipboard from NodeJS const output = "some string"; require("child_process").spawn("clip").stdin.end(output);
javascript VSTS Test Coverage with Mocha, Istanbul, NYC, Coburtura and Junit package.json "scripts": { "test": "nyc -r cobertura -r html mocha **/*test*.js -R mocha-junit-reporter" }, "devDependencies": { "mocha": "^2.5.3", "mocha-junit-reporter&
typescript The power of ES 2017 (es8) in TypeScript even with NodeJS 6.11.0 { "compilerOptions": { "module": "commonjs", "target": "es6", "lib": [ "es2017", "dom" ] }, "exclude": [ "node_modules" ] } This tsconfig.
javascript Legitimate uses of undefined in JavaScript As function argument placeholders? Yes. To mark a variable for garbage collection? Yes. For instantiation? No. let x = undefined; // don't do this