There are a number of different ways to get the last element of an array in JavaScript. Below we will explore those techniques, each with a simple example. The Most Common Technique Using length() -1 The … [Read more...] about How to Get the Last Element of an Array in JavaScript
JavaScript
How to use document.write() in JavaScript
How to use document.write() in JavaScript The document.write() function is commonly used when testing simple web applications or when learning JavaScript. document.write() will print the contents of the parameter … [Read more...] about How to use document.write() in JavaScript
How to Open a New Tab with JavaScript
Opening a new browser window in a new tab can be done easily in JavaScript. Modern web browsers provide a simple API that creates an interface called the window object. Since the goal is to open a new location in … [Read more...] about How to Open a New Tab with JavaScript
JavaScript String lastIndexOf Method Explained
The lastIndexOf() method is useful for determining the index at which a string is contained in another string. If the string that is passed as a parameter to the lastIndexOf() method does not exist in the string, … [Read more...] about JavaScript String lastIndexOf Method Explained
JavaScript String Italics Method Explained
The HTML code to wrap text in HTML italics tags can be generated using JavaScript. Important Note: The italics method is not standardized and may not behave consistently in all browsers. It should be avoided … [Read more...] about JavaScript String Italics Method Explained
JavaScript String indexOf Method Explained
The indexOf() method is useful for determining the index at which a string starts at, if that string is contained inside another string. If the string that is passed as a parameter to the indexOf() method does not … [Read more...] about JavaScript String indexOf Method Explained
JavaScript String includes Method Explained
The includes() method is useful for determining if a string contains a predetermined value. Note: This method will return a boolean value. The example below demonstrates a typical use case for the includes() … [Read more...] about JavaScript String includes Method Explained
JavaScript String fromCodePoint Method Explained
The fromCodePoint() method allows JavaScript to create a string from a sequence of UTF-16 or UTF-32 character codes and is useful for dealing with characters that are difficult to type or need to be escaped. Note: … [Read more...] about JavaScript String fromCodePoint Method Explained
JavaScript String fromCharCode Method Explained
The fromCharCode() method allows JavaScript to create a string from a sequence of UTF-16 character codes and is useful for dealing with characters that are difficult to type or need to be escaped. Note: This method … [Read more...] about JavaScript String fromCharCode Method Explained
How to Convert an HTML Node to a String in JavaScript
For various reasons, you may want to get the HTML code of a specific element in an HTML document. This is relatively easy to do, with the main problem being that you will need to identify a unique way to select the … [Read more...] about How to Convert an HTML Node to a String in JavaScript