JavaScript Wisdom ๐Ÿ”ฅ (@jswhizz) header
JavaScript Wisdom ๐Ÿ”ฅ (@jswhizz) profile picture

Biweekly dose ๐Ÿ’‰ of JavaScript wisdom delivered in bite-sized ๐ŸŒฎ tweets. Written by @superkarolis ๐Ÿ‘จโ€๐Ÿ’ป

Earth ๐ŸŒŽ
Joined July 2018
console.log() is undoubtedly the most common way to debug #JavaScript applications. However, #googlechrome developer tools have great debugging tools as well, primarily breakpoints which you can use to track the state of variables. Check out more medium.com/datadriveninvestoโ€ฆ ๐Ÿ“š
1
1
1
Expression produces a value and can be written wherever a value is expected. On the other hand, statement performs an action without producing a value. Wherever #JavaScript expects a statement, you can also write an expression. Such a statement is called an expression statement.
When receiving data from a web server, data is always a string. You can pass such data JSON.parse() and get a JavaScript object. JSON.stringify() is a reverse method and converts JSON to a string. These methods in combination can be used to efficiently clone objects. #javascript
JSON (#JavaScript Object Notation) is a popular format for structuring data. It is based on a subset of JavaScript language, is alternative to XML and is mostly used to transmit data between a server and web client. It is made up of key/value pairs. Below is an example of JSON ๐Ÿ‘‡
4
5
While a lot of us have started making websites using jQuery, there is really no need to still use it when developing for the the modern web. Check out youmightnotneedjquery.com/ for examples on how to replace common jQuery code snippets and see some examples below ๐Ÿ‘‡ #javascript
4
13
LHS stands for left-hand side, and RHS stands for right-hand side. LHS references are located on the left hand side of the = assignment operator. RHS references are located on the right-hand side of the of the = assignment operator or implied when there is no LHS reference.
1
3
While there are no true named and optional arguments in #JavaScript, it is possible to get functionally equivalent behavior by using #ES6 destructuring. This pattern is great because it allows you to explicitly define what you are expecting to receive and set up the defaults.
6
15
#ES6 and #ECMAScript2015 (or #ES2015), are all different names for the same thing. ES6 was the popularized name prior to new language release. However, the ECMAScript committe decided to use ES2015 instead as the official name to reflect the year of release.
1
3
In #javascript, parameters of functions default to undefined. Since #ES6 came out, default function parameters became part of the language specification. They allow formal parameters to be initialized with default values if no value or undefined is passed.
3
14
Modules refer to small units of independent, reusable code. There are several different module systems in #JavaScript - CommonJS, Asynchronous Module Definition (AMD) and ECMAScript 6 modules (Native JavaScript). Let's have a look at each ๐Ÿ‘‡
1
5
Lighthouse by Google is a great resource for developers interested in web performance and quality. To put it short, it is an automated tool for auditing performance, accessibility, progressive web apps, SEO and more. It's available on Chrome Dev Tools ๐Ÿ‘‰ developers.google.com/web/toโ€ฆ
1
2
2
By using destructuring in #ES6 it is possible to swap two regular variables or elements of an array in a much more efficient manner in terms of lines of codes than in previous versions of #JavaScript. See the example ๐Ÿ‘‡
4
10
Linting is the process of checking the source code for programmatic as well as stylistic errors. This is most helpful in identifying various mistakes that are made during coding. Check out this comparison of linting tools ๐Ÿ‘‰ย codeburst.io/javascript-lintโ€ฆ #javascript #programming
1
2
Test-driven development #TDD is an approach to development that consists of writing tests, followed by production code, and refactoring as needed. The tests are written initially, and the developer writes code to fulfill the requirements of the test so they pass. #javascript
3
10
Destructuring in #JavaScript #ES6 is a convenient way of extracting values from objects and arrays. Object destructuring often consists of a basic assignment where variable names match those of object keys. Array destructuring works by mapping variables based on the array index.
2
11
Math in #JavaScript is a built-in object that has properties and methods for mathematical constants and functions, all of which are static. Note that many #math functions have a precision that's implementation-dependent and thus results may differ on various browsers and OSes.
4
12
Closure in #JavaScript is when a function is able to access its lexical scope even when that function is executing outside its lexical scope. Closure has three scope chains: its own scope, outer functionโ€™s scope, and global scope. They make the code more clear and readable.
3
10
#JavaScript Throttling vs debounce. Throttling delays executing a function. It reduces the notifications of an event that fires multiple times. Debouncing ensures that one notification is made for an event that fires multiple times. See it visually ๐Ÿ‘‰ demo.nimius.net/debounce_thrโ€ฆ
5
7
#ES6 functions are also called fat-arrow functions due to => being used in the syntax. Fat-arrow functions do not have their own binding and instead retain the context of their enclosing lexical context. They also have cool features like implicit returns and short-hand syntax.
3
10