Invest with Cake DeFi and get guaranteed returns from your crypto assets. Register Now

All Posts tagged as "JavaScript"

Difference between: function Person(){}, var person = Person(), and var person = new Person()?

Have you seen this question before?

Get the last items of an array using array.slice()

I never knew the slice method takes negative integers!

How to copy an object from the Chrome inspector console as code

Have you ever do console.log an object and wondering how can copy the object over?

Top-level await

How to use top-level await in ES Modules without all of the crazy hack

NPM vs Bower vs Browserify vs Gulp vs Grunt vs Webpack

Repost my killer answer on StackOverflow with more than 600 votes

What is JavaScript Closure?

In short, a closure is not the function that is returned in another function. A closure is a combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment). In other words, a closure gives you access to an outer function’s scope from an inner function

Error handling in JavaScript. Synchronous vs asynchronous code

Error handling in JavaScript has been always straightforward, at least for synchronous code

Casting a JSON object to a TypeScript class

Not all the time we need to cast from JSON object to a class, but sometimes it is really helpful. Use class-transformer to transform JSON object to class instance

Freeze screen in Chrome debugger / DevTools panel for inspect element that will disappear on hover/click

Run the setTimeout to trigger debugger before the element disappearing 🤓

How we handle time zone and locale at Zyllem

Using momentjs parseZone functionality for that purpose

Uncaught TypeError: Cannot read property 'name' of undefined

It is a very common error when working with object and array to get a TypeError: Cannot read property 'name' of undefined. This happens when we try to access a property of a value that is undefined or null in JavaScript

Find a sequence to produce a number by adding 5 or multiplying by 3

Just read an interesting problem this morning. It seems not to be difficult

JavaScript naming convention

There are only two hard things in Computer Science: cache invalidation and naming things

ES6 in my daily life

ES2015/ES6 has been around for more than two years with all the exciting feature and syntax. After working with TypeScript and Angular 2 in a project for more than a year, there are the features that I often apply in my code.