JavaScript’s inbuilt method trim() removes whitespace from both ends of a string. The Syntax: str.trim() The method returns new string representing the str stripped of whitespace from both ends. Try yourself
Category: JavaScript
What is New in ES6
ES (ECMAScript) is the official name of JavaScript. ES6 was released in June 2015, which is stated as the sixth edition of the language. It is also known as ECMAScript [ … ]
Sort Array of Objects by Property Value in JavaScript
In this article I will discuss about how to sort array of objects by property or key value. Consider the following array of objects: Suppose you want to sort the [ … ]
Case Conversion: Convert String to Lower Case, Upper Case and Title Case With JavaScript
Convert String to Lower Case : In lower case, all letters of string appears in their small forms. Using the inbuilt toLowerCase() method we can easily convert given text to [ … ]
Important JavaScript Array Methods
In this article I will discuss about some of the important inbuilt array methods in JavaScript. I will cover the following methods: length, concat, sort, reverse, split, join, push, pop, [ … ]
How to Check If a Value Exists in an Array in JavaScript
You can use the indexOf() method to check if a given element exists in an array or not. The indexOf() method returns the index of the element inside the array if it is found, [ … ]
How to Check If An Object is Empty in JavaScript
There are various ways to check if an object is empty in JavaScript. Method 1: Using JavaScript JSON.stringify method – Method 2: Looping through object keys – Try yourself
Spread Operator in JavaScript
The spread operator (…) is a new powerful feature introduced in JavaScript ES6. It allows expansion of iterables such as arrays, objects, and function’s arguments in place where zero or [ … ]
Data Types in JavaScript
What is Data Type? In programming the term Data Type refers to type or classification of data that a variable can hold and operations that can be performed on it. [ … ]
Different Ways to Define a Function in JavaScript
A function is piece of code or group of statements that performs a particular task. The code within a function gets executed only when it is referenced or called. For [ … ]