Javascript We have a global variable sentence and it holds a long string as its value. We have created the showSentence() method. This method will set our global string as an inner text of the inner div element. We are calling this method in the next line. We have selected the button element using the
In this tutorial, you will learn how to check if an element is present in an array in javascript. In an array, we can have duplicate items, and to keep our array filled with unique items, we need to verify if an element is already present in it or not. There are various approaches to
In this tutorial, you will learn how to remove particular element from array in javascript. As you know, arrays can contain duplicate items so removing an element based on the value is not the right approach. Arrays have a 0-based index. This means each item in the array has its unique index number and the
In this tutorial, you will learn how to check if a variable is undefined or null in javascript. Whenever you create a variable and do not assign any value to it, by default it is always undefined. It simply represents a lack of value. On the other hand, you can explicitly assign null to a
In this tutorial, you will learn how to check if a variable is an array in javascript. An array is a collection of items irrespective of their data types. They are easy to modify because each item in an array has its unique index number. However, the index does change depending upon the kind