Skip to content

Tag: ecmascript-6

JSDoc: arrow function params

I’m trying to document my code with JSDoc (EcmaScript 2015, WebStorm 12 Build 144.3357.8). I have an arrow function which I want to document its parameters. This two examples work (I get auto-completion): But when I want to document an arrow function in forEach function, for example, the auto-completion…

Can you bind ‘this’ in an arrow function?

I’ve been experimenting with ES6 for a while now, and I’ve just come to a slight problem. I really like using arrow functions, and whenever I can, I use them. However, it would appear that you can’t bind them! Here is the function: Here is the object I want to bind the function to: And here …

TypeScript export vs. default export

What is the difference in TypeScript between export and default export? In all the tutorials, I see people exporting their classes and I cannot compile my code if I don’t add the default keyword before exporting. Also, I couldn’t find any trace of the default export keyword in the official TypeScr…

Square Brackets Javascript Object Key

Can anyone explain how the why/how the below method of assigning keys in JavaScript works? return: Answer It’s the new ES2015 (the EcmaScript spec formally known as ES6) computed property name syntax. It’s a shorthand for the someObject[someKey] assignment that you know from ES3/5: is syntactic su…