Category – JavaScript
2 posts tagged with "JavaScript" (See all categories)

JJavaScript returns undefined if curly brace is on next line

08/28/20182 Min Read — In JavaScript

Semicolons are optional in JavaScript. If you do not open a brace or add your return object to the same line as the return statement, JavaScript will interpret this as desiring to return undefined. const returnHelloWorld = () => { return { message: 'hello world', }; }; const returnUndefined…

JJavascript var vs let

07/17/20162 Min Read — In JavaScript

You’ve seen let and var used and for the most part they appear to be interchangeable but what exactly is the difference between let and var? The simplest explanation of the difference between let and var is that let is bound by block scope while var is bound by function scope. Consider the following…