JavaScript

JavaScript Semicolon: Do You Really Need It? [2022 Guide]

In JavaScript, semicolons are optional. Yes, you heard it right. However, there are some situations in which omitting a semicolon can lead to unwanted consequences. So there is no definitive answer as to whether you should use a semicolon or not. Using semicolons always causes a debate in the JavaScript community. There are good arguments …

JavaScript Semicolon: Do You Really Need It? [2022 Guide] Read More »

Clone an Object in JavaScript: 4 Best Ways [Updated 2022]

In JavaScript, objects are reference values. This means you cannot use the assignment operator (=) to clone objects. If you do, you are just creating an alias to the existing object. To clone a JavaScript object correctly, you have 4 different options: Use the spread operator. Call the Object.assign() function. Use JSON parsing. Use the …

Clone an Object in JavaScript: 4 Best Ways [Updated 2022] Read More »