
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

1K+ Views
To find the cubes of elements of given array we need to run a for loop to access each and every element and we need to use "=" operator to replace elements with their cubes.To get the desired values the below steps need to be followed.Steps1) Declared an array a = [1, 2, 3, 4, 5]2) For loop was introduced to access each and every element in the array(a[i]).3) Inside for loop "=" operator is used to replace the element with their cubic values(a[i]*a[i]*a[i]).so, from the above steps the output obtained will be 1, 8, 27, 64, 125.By following the ... Read More

208 Views
JavaScript Bitwise NOT Live DemoExample document.getElementById("not").innerHTML = ~ 13; Output-14Explanation: It gives 0 for 1 and 1 for 0.The above result is 14.JavaScript Bitwise leftshift operator Live DemoExample document.getElementById("left").innerHTML = 5

1K+ Views
Html taga) The tag is used to define a client-side script.b) The tag contains scripting statements or an external script file.JavaScript code must be keep in script tag.Let's see the use of the tag. For suppose declare the variable outside the script tag. Live DemoExample var a = 1; var b = 2; var c = a + b; document.getElementById("tag").innerHTML = c; Outputvar a = 1For suppose, let the variable be declared inside the script tag. Live DemoExample var a = 1; var b = 2; var c = a + b; document.getElementById("tag").innerHTML = c; Output3

215 Views
JavaScript TagsThe html script tag wants the browser to get a script between them. We can expect the scripts to be in the following places. 1.The script can be placed in html's head tag 2.Within Html's body tag. 3.As an external file. Most importantly client side scripts such as JavaScript are placed in script tags.demonstration code Live Demo This example writes "JavaScript is not java" into an HTML element with id="script" document.getElementById("imp").innerHTML = "JavaScript is not java"; OutputThis example writes "JavaScript is not java" into an HTML element with id="script" JavaScript is not javaExplanationEvery JavaScript code should be in ... Read More

2K+ Views
There are 4 ways to display the output in JavaScript. a) Displaying the output in HTML elements, using innerHTML attribute. Live DemoExample document.getElementById("display").innerHTML = 10 + 10; Output20.b) Displaying the output using document.write(). Live DemoExample document.write(2 + 3); Output5c) Displaying the output through console.log(). Live DemoExample console.log(2 + 3); In debugger console, the output5.d) Displaying the output through alert box. Live DemoExample alert(2 + 3); In alert window box, the output5In case of handling json strings, or some other big data console.log is the best choice.

74K+ Views
In JavaScript, the object is a real-time entity that contains properties and methods. In simple words, we can say that object is an instance of a class. It stores the data in the form of key and value pairs. The keys are usually referred to as properties and the values are referred to as property values. There are two ways to define an object in JavaScript. Syntax var obj = new Object(); (or) var obj = {property1: value, property2 : value2 …….} Using dot (.) operator In JavaScript, using the dot (.) operator we can access a variable ... Read More

2K+ Views
An array in JavaScript is an datatype which contains similar types of data. A number array is defined as the array object with numbers as its content. These numbers are divided into even and odd types on a basic level of mathematics. In this article, we will look into outputting the even number of any number array. Syntax let arr = [val1, val2, val3, …]; Now, let us consider an array arr with numbered elements and print the content in the 0th index − Example let ... Read More

201 Views
add and assignment(+=) operatorThe add and assignment(+=) operator reduces the code little bit.It may not much influential in small codes whereas coming to long codes it's use can't be ignored. Live DemoExample var tot = 0; var a = [1,45,78,9,78,40]; for(var i = 0; i