
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 6710 Articles for Javascript

216 Views
The ArrayBuffer.isView() method tells us if the passed parameter value is an ArrayBuffer view or not.Following is the code for ArrayBuffer.isView() method −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .sample { font-size: 20px; font-weight: 500; } JavaScript ArrayBuffer.byteLength property CLICK HERE Click on the above button to check the above value is array buffer view or not let fillEle = document.querySelector(".sample"); var buffer = new ArrayBuffer(8); var view1 = new DataView(buffer); view1.setInt16(0, 0x2721); fillEle.innerHTML = view1.getInt16(0).toString(16); document.querySelector(".Btn").addEventListener("click", () => { ... Read More

120 Views
The byteLength property return the length of an ArrayBuffer in byte. Following is the code for ArrayBuffer.byteLength property −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .sample { font-size: 20px; font-weight: 500; } JavaScript ArrayBuffer.byteLength property CLICK HERE Click on the above button to see the array buffer size let fillEle = document.querySelector(".sample"); var buffer = new ArrayBuffer(8); var view1 = new DataView(buffer); view1.setInt16(0, 0x2721); fillEle.innerHTML = view1.getInt16(0).toString(16); document.querySelector('.Btn').addEventListener('click',()=>{ fillEle.innerHTML = 'The array buffer size is '+view1.byteLength+' bytes'; }) OutputOn clicking the “CLICK HERE” button −

787 Views
In this article, we will learn about JavaScript ArrayBuffer objects. The ArrayBuffer object in JavaScript is a fundamental part of the Web API for efficiently handling binary data. What is ArrayBuffer? The JavaScript ArrayBuffer object represents a generic, fixed-length raw binary data buffer. To manipulate the contents of an ArrayBuffer object we have to create a DataView object as we cannot manipulate the contents directly. We can read and write both using the DataView object. Syntax new ArrayBuffer(byteSize) The byteSize parameter specifies the array buffer size in bytes that will be created. Use Cases of ArrayBuffer Following are the use ... Read More

168 Views
The JavaScript array.values() return an iterator object that contains all the values of a given array.Following is the code for array.values() function −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .sample { font-size: 20px; font-weight: 500; } JavaScript array.values() CLICK HERE Click on the above button to see the array values only let fillEle = document.querySelector(".sample"); let arr = ["cow", "bull", "lion", "tiger", "sheep"]; var entries = arr.entries(); for (let x of entries) fillEle.innerHTML += x + ""; document.querySelector(".Btn").addEventListener("click", () => { ... Read More

142 Views
The JavaScript array.toLocaleString() function returns the elements of an array as a string and are separated by a locale specific string such as comma. It can take locale as parameter which specifies the language tag in which the string is to be converted.Following is the code for the array.toLocaleString() functionExample Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .sample { font-size: 20px; font-weight: 500; } JavaScript array.toLocaleString() CLICK HERE Click on the above button to convert the array to UK locale string let ... Read More

2K+ Views
To check if a given year is leap year, We have used two approaches in this article. A leap year has 366 days. In every 4th year, an additional day is added to the month of February to synchronize it with astronomical year. In this article, we are given with two years to check. Our task is to write a JavaScript program to check if a given year is leap year. Approaches to Check Leap Year Here is a list of approaches to check if a given year is leap year in Javascript which we will be discussing ... Read More

295 Views
In this article, we will demonstrate how to capture the mouse position in JavaScript at regular intervals and log or use this data for various purposes. Capturing mouse positions after every given interval refers to a program or functionality where the current position of the mouse pointer is tracked at regular time intervals. This can be useful in scenarios like debugging, interactive applications, or visualizing user movement on a web page. Use Cases Imagine you want to monitor user activity on a web page and record the mouse position every second. This can be useful for: ... Read More

663 Views
In this article, we will learn to use the prompt() function in Javascript. The prompt() method in JavaScript allows developers to collect user input through a pop-up dialog box. What is the prompt() Method in JavaScript? The prompt dialog box is very useful when you want to pop-up a text box to get user input. Thus, it enables you to interact with the user. The user needs to fill in the field and then click OK. This dialog box is displayed using a method called prompt(). Syntax var userInput = prompt("Message", "Default value"); The following are the parameters of the ... Read More

468 Views
The JavaScript BOM Window screen contains the information about the client’s screen.The BOM window screen properties are −PropertiesDescriptionscreen.widthReturn the user screen width in pixels.screen.heightReturn the user screen height in pixels.screen.availWidthReturns the user screen width in pixels without taking into account the interface features.screen.availHeightReturns the user screen height in pixels without taking into account the interface features.screen.colorDepthReturns the bits used to display one colorscreen.pixelDepthRetrurns the screen pixel depthFollowing is the code for the JavaScript BOM Window screen −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result { font-size: 18px; ... Read More

736 Views
In this article, we will learn about different basic array methods in JavaScript. Adding and Removing Elements Some basic JavaScript array methods for adding and removing elements − Method Description ... Read More