DALLASCAO.COM

Site of Cao Shouguang, English to Chinese translator

chain game code [rock, scissor, paper]

chain game code [rock, scissor, paper]
class chainGame {     /**      *      * @param {Array} hands two players hands. e.g. [1,2]      * @param {Array} symbols  symbols of the game      */     constructor(hands, symbols) {         this.hands = hands         this.symbols = symbols     } […]Read More

Javascript: Always define var outside if

Javascript: Always define var outside if
if (true) {     const a="yes" } else {     const a="no" } console.log(a); //throw an error that a is not definedRead More

this in object method functions

this in object method functions
//three ways of writing a method function for an object const temp = {     name:"dallas",     method1:function(){         console.log(this.name); //dallas     },     method2() {         console.log(this.name); //dallas     },     method3:()=>{         console.log(this.name); //undefined     }   […]Read More

ES6: Let async functions return promise object

ES6: Let async functions return promise object
function myWait (){         return (() => {             return new Promise(function (resolve) {                 function Callback() {                     resolve("All right sparkly");                 }; […]Read More

Make Windows 10 Mail work with custom SMTPs

Make Windows 10 Mail work with custom SMTPs
I run my own mail server but I want to use smtp.sendgrid.net to send mails so I can see whether my mails are delivered and opened. Windows 10 Mail is a great app, except that it doesn’t work. Microsoft is stupid. It will create a program with critical bugs but will never correct it. Here […]Read More