Design patterns are blueprint solutions to common programming problems. Most of the credit for classifying and describing the design patterns goes to the “Gang of Four” - Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides....
There are 2 ways to get access to the object properties in JS:
Dot notation: user.name Square bracket notation: user['name'] In both cases we’ll get access to the property name of the object user....
To get started with the dynamic access to object properties in JS, let’s first take a look at how you could get access to a static object property.
const user = { age: 25, name: 'Jack' } console....
In Express.js all the query parameters are stored in the object req.query, so you can access them in any of your route handlers or middleware functions.
So imagine your Express backend is running on https://learn....
All JavaScript functions return something. However, if your function is async it’s going to return a Promise, so you can use the keyword await to get the value that the promise resolves to....
Object.freeze is a handy tool that helps you make an object immutable in JavaScript.
Object.freeze(someObject); If you try use the delete keyword or an assignment operator = after freezing the object with Object....
You can remove properties (fields) from the JavaScript objects using the delete keyword.
const user = { name: 'John', age: '25', isLearning: true }; delete user.age; delete user['isLearning']; console.log(user.name); // John console....
If you want to redirect to another page with JavaScript, you can use the window.location object. This object is part of the window global object and has a property called href....
A missing "use strict" error is common when you use ESLint. There are 2 possible fixes to it:
add the statement “use strict” in double quotes as a first line in your JS file "use strict" //the rest of your JS code goes below // AND must be in a strict mode add a custom ESLint rule (as a comment!...
The “strict mode” was introduced in ECMAScript 5. It allows you to put your script into the “strict” operating mode which prevents certain (potentially dangerous) operations.
ES6+ classes and native ECMAScript modules have strict mode enabled by default....