Found 6710 Articles for Javascript

How to create tabs with CSS and JavaScript?

Aman Kumar
Updated on 19-Dec-2022 12:44:10

6K+ Views

In this article, we are going to discuss how to create tabs with CSS and JavaScript. Tabs are containers whose main purpose is to show and navigate through the diverse content of the website. Tabs are commonly used to manage the space and make the website more user-friendly without reloading too many times. The content in these tabs are usually closely related but mutually exclusive. There are several types of tabs which can be created and used in various cases − Horizontal tabs Horizontal with Secondary Tabs Frameless Horizontal Tabs Vertical Tabs Vertical Tabs with Second Tabs ... Read More

How to Install Grunt on Ubuntu?

Sharon Christine
Updated on 22-Jan-2020 06:08:04

2K+ Views

Grunt (The JavaScript assignment Runner) is an automation tool to perform repetitive duties like compilation, unit testing etc. Grunt and Grunt plugins are hooked up and managed through NPM, the Node.Js package manager. This article explains about – How to install Grunt on Ubuntu.To install grunt on ubuntu, it should require pre-installed Node.js and NPM. To verify the version of Node.js, use the following command –$ node --versionThe sample output should be like this –v6.9.2To verify the version of NPM, use the following command –$ npm --versionThe sample output should be like this –3.10.9If you wants to install Node.js and ... Read More

Debugging JavaScript using Firebug

Sharon Christine
Updated on 20-Jan-2020 08:14:23

780 Views

Debugging is the systematic method of removing defects. It all starts with execution of test cases. Whenever test cases are executed, the actual results are compared with expected results. If there is any lack of correspondence between the actual results and expected results, root cause analysis is done and additional tests such as regression tests are performed so as to ensure that the results are along the expected lines.To design static web pages, HTML is widely used. To develop dynamic web-based applications, JavaScript, the scripting language of the web should be used. To make their code bug-free, programmers rely on ... Read More

Difference between != and !== operator in JavaScript Program

Mahesh Parahar
Updated on 13-Jan-2020 06:28:36

599 Views

'!=' comparison operator'!=' operator checks the unequality of two objects without making the type check. It converts the datatype of two operands to one and then compares their value. For example 1 != '1' will results false.'!==' comparison operator'!==' operator checks the unequality of two objects with a type check. It does not converts the datatype and makes a typed check.For example 1 !== '1' will results true.Following example, shows usage of '!=' vs '!==' operators.Example    Operator Example           console.log(" 1 != '1' " + (1 != '1'));       ... Read More

Difference between JSON and XML

Mahesh Parahar
Updated on 24-Feb-2020 08:08:04

376 Views

Both JSON and XML are the most popular data transversal resources in programming world.Due to their various important characteristics and features both of these resources are widely used globally.On the basis of their features following are the important differences JSON and XMLSr. No.KeyJSONXML1AbbreviationJSON stands for JavaScript Object Notation.On other hand XML stands for Extensible Mark-up Language.2TypeJSON format is data interchangeable.On other hand XML format is Mark-up language.3Based onJSON is derived from JavaScript language from where it puts the feature to represents the data in a way of representing objects.On other hand XML is derived from SGML and uses tag structure ... Read More

JavaScript symbol.description property

AmitDiwan
Updated on 17-Dec-2019 11:03:49

109 Views

The symbol.description property in JavaScript converts a Symbol object to a primitive value. The syntax is as follows −Symbol()[Symbol.toPrimitive](hint);Example Live Demo Demo Heading Click to display... Result    function display() {       const val = Symbol('john');       console.log(val[Symbol.toPrimitive]);    } OutputClick the “Result” button −Example Live Demo Demo Heading Click to display... Result    function display() {       const val = Symbol(2465);       var res = val[Symbol.toPrimitive](99);       console.log(res)    } OutputClick the “Result” button and get the result in Console −

JavaScript Array.prototype.values()

AmitDiwan
Updated on 17-Dec-2019 10:58:48

184 Views

The array.values() method of JavaScript returns a new Array Iterator object that contains the values for each index in the array.The syntax is as follows −arr.values()Let us now implement the array.values() method in JavaScript −Example Live Demo Demo Heading Click the button to display the value... Result    function display() {       var arr = ['p', 'q', 'r'];       var res = arr.values();       document.getElementById("test").innerHTML = res.next().value    } OutputClick on the “Result” button −Example Live Demo Ranking Points Click to display the points... Result   ... Read More

JavaScript toLocaleString() function

AmitDiwan
Updated on 17-Dec-2019 10:55:12

264 Views

The toLocaleString() method of JavaScript is used to convert a Date object to a string using locale settings.The syntax is as follows −Date.toLocaleString(locales, options)Above, the locales parameter is the language specific format to be used −ar-SA Arabic (Saudi Arabia) bn-BD Bangla (Bangladesh) bn-IN Bangla (India) cs-CZ Czech (Czech Republic) da-DK Danish (Denmark) de-AT Austrian German de-CH "Swiss" German de-DE Standard German (as spoken in Germany) el-GR Modern Greek en-AU Australian English en-CA Canadian English en-GB British English en-IE Irish English en-IN Indian English en-NZ New Zealand English en-US US English en-ZA English (South Africa) es-AR Argentine Spanish es-CL Chilean Spanish ... Read More

JavaScript Array.splice() Method

AmitDiwan
Updated on 17-Dec-2019 10:50:17

221 Views

The splice() method of JavaScript is used to add or remove item. It returns the removed item.The syntax is as follows −array.splice(index, num, item1, ....., itemX)Here, index is the integer specifying at what position to add or remove items, num is the number of items to remove, item1…itemX are the items to be added to the array.Let us now implement the splice() method in JavaScript −Example Live Demo Products Click to display the updated product list... Result    var products = ["Electronics", "Books", "Accessories"];    document.getElementById("test").innerHTML = products;    function display() {       products.splice(1, 2, ... Read More

JavaScript Array.prototype.map() function

AmitDiwan
Updated on 17-Dec-2019 10:44:09

138 Views

The Array.prototype.map() function of JavaScript is used create a new array with the results of called function.The syntax is as follows −arr.map(function callback(currentValue[, index[, array]])Let us now implement the Array.prototype.map() method in JavaScript −Example Live Demo Demo Heading Click to display the abs() result... Result    function display() {       var arr = [1, -2, 3, 4, 5, -6, 7, 8, 9, 10];       var res = arr.map(Math.abs);       document.write(res);    } OutputClick the “Result” button above −Example Live Demo Demo Heading Click to round the numbers... Result ... Read More

Advertisements