Skip to main content

Posts

Showing posts with the label JavaScriptTips

JavaScript important array functions

  Not really next-gen JavaScript, but also important: JavaScript array functions like   map()   ,   filter()   ,   reduce()   etc. You’ll see me use them quite a bit since a lot of React concepts rely on working with arrays (in immutable ways). The following page gives a good overview of the various methods you can use on the array prototype — feel free to click through them and refresh your knowledge as required:  https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array map()  =>  https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map find()  =>  https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find findIndex()  =>  https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex filter()  =>  https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter reduce()  =>  https://developer.mozilla.org/en-US/d

Next-gen JavaScript Features

In this module, I provided a brief introduction to some core next-gen JavaScript features. Here’s a quick summary! let & const Read more about let :  https://developer.mozilla.org/en-US/  docs/Web/JavaScript/Reference/Statements/let Read more about const:  https://developer.mozilla.org/enUS/docs/Web/JavaScript/Reference/Statements/const let and const basically replace var . You use let instead of var and const instead of var if you plan on never re-assigning this “variable” (effectively turning it into a constant, therefore). ES6 Arrow Functions  Read more:  https://developer.mozilla.org/en-US/docs/Web/  JavaScript/Reference/Functions/Arrow_functions Arrow functions  are a different way of creating functions in JavaScript. Besides a shorter syntax, they offer advantages when it comes to keeping the scope of this keyword (see here). Arrow function syntax may look strange but it’s actually simple. function callMe(name) { console.log(name); } which you could also write as: const c