In this post, I will show you three different JavaScript programs to remove the last character of a string. For example, if the string is hello1, it will print hello. Try to run these examples and drop one comment below if you have any queries.
ReadIn this tutorial, we will learn how to check if an object is empty or not in Javascript. This is one of the important things to learn if you are developing any javascript application. You can't be sure that any object you are receiving either from an API or from a function will be non-empty always. So, instead of breaking your code, you should always check if an object is empty or not. This is a good coding practice and we should follow it on any programming language, not only in Javascript.
ReadFinding out if an object is in an array or not is little bit tricky. indexOf doesn't work for objects. Either you need to use one loop or you can use any other methods provided in ES6. Loop is not a good option. JavaScript provides a couple of different methods that makes it more easier.
ReadJavaScript comes with a couple of different array methods. You don't have to loop through each elements of an array to check if they are in a second array. In this post, I will show you different ways to check if all elements of an array is in another way or not. in a second array
ReadThis is a JavaScript practice problem. We will learn how to find the area and perimeter of a circle in JavaScript. We will use one class to solve this problem.With this program, you will get familiar with JavaScript class and object.JavaScript Math class and how to use constants of Math class in a JavaScript program.
ReadFind the sum of all odd numbers smaller than a number in JavaScript in three different ways. We will use a for loop, while loop and loops with jumping the numbers to find the required sum.
ReadJavaScript provides two methods join() and toString() to convert array elements to a string with comma-separated values. toString() method is inherited from the Object class. It was introduced in ECMAScript 5. Both methods actually return the same string value. One more thing is that we can change the separator in the join method. Let me show you with examples :.
ReadIf you are working with date, you should always get aware of these two terms- ISO and UTC. ISO 8601 is a standard used for date-time representation. The way date is represented, the date separators are not the same for all countries. Using ISO 8601, we can convert all times to a similar format. So, if we store the ISO date on the database, it can be converted and represent as we like on the frontend.
ReadJavascript copyWithin() method is used to copy a portion of one array in the same array in a range. copyWithin doesn't modify the array size. It just copies the elements to separate indices. This method is useful if you want to copy one part of the array or subarray to another part.
ReadTrimming is used to remove whitespace characters from a string. Javascript provides us different methods to remove whitespaces from the start, end and both sides of a string. Whitespace is any whitespace character like tab, space, LF, no-break space, etc.
Read