Skip to content

Author: admin@master

Why are Javascript promises resolving out of order?

I am attempting to use JavaScript promises in a project and the order of events are unexpected. I have narrowed it down into a small demo using a test promise. And then I call it like so: This is the console output: How can I get an output of: Answer .then() expects a function reference. When you do something…

const enum in Typescript

I have a React application that is using Typescript. Right now I’m running into an issue with const enum. Here’s my enum: The service I’m trying to match up to isn’t returning the value, but the index of the item within the enum. So, for instance, if the user is set to snack on an appl…

Pug – generating Select and Options

I am new to Pug and I am trying to generate a Select set of Options like this: However the result I get, in the rendered page, is an empty select input followed by the list of options as text Answer Indents the code https://pugjs.org/language/iteration.html

Serializing an ES6 class object as JSON

I’d like to serialize myClass object to json. One easy way I can think of is, since every member is actually javascript object (array, etc..) I guess I can maintain a variable to hold the member variables. this.prop.foo = this.foo and so on. I expected to find a toJSON/fromJSON library for class objects…

Vue.js Routing with back button

I already use this Vue.js Routing example application. In the src/main.js I have so much data value . Now with socket.io i set the token to “sdawdda2d2ada2ad22ad” When application start than the currentRoute is equal with “/” Its okey, the first page loaded. src/routes.js When i want t…