
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

533 Views
JavaScript provides us with functions, that are a collection of pre-defined instructions or statements that are only carried out when we call the function that contains this code. The function accepts one or more arguments as input and output. You can pass values or references for the input arguments. All function parameters are always given by value in JavaScript. It indicates that JavaScript inserts copies of variable values into function parameters. The passing variables outside of the function are not affected by any modifications you make to the function's internal arguments. Or, to put it another way, changes made to ... Read More

435 Views
In simple html form, the form elements keeps value with it internally and submit on form submission button.Example Form Example User Name: In above example, we have a simple input called username and we can receive its value on form submission. The default behavior of html form is to navigate to new page i.e. the post form submission page.But it can give more advantage if we have a form submission handler JavaScript function which can validate the form data as ... Read More

574 Views
Regular functions vs Arrow functionsAn arrow function is used to write the code concisely. Both functions regular and arrow work in a similar manner but there are some differences between them. Let's discuss those differences in a nutshell.syntax of an arrow functionlet x = (params) => { // code };syntax of a regular functionlet x = function functionname(params){ // code };Usage of "this" keywordIt is unable to use "this" keyword in arrow functions whereas in regular functions it can be used without any disturbance.ExampleIn the following example, both regular(rectangle) and arrow(square) functions were used inside the object "num", which consists of len(length) ... Read More

3K+ Views
This article discusses about \d vs\ D in JavaScript regex. The \d and \D meta characters are used to match the characters of a given string. \d and \D are different from each other. \d (character) is equivalent to [0-9] that means it matches any single number. The characters that are not matched by the \d are matched by the \D. \D is equivalent to [^0-9] that means it matches any character other than number. Both \d and \D are completely inverse to each other. To match a string with a pattern, the possible methods are: string.match(pattern), string.search(pattern), pattern.exec(string), pattern.test(text). ... Read More

4K+ Views
This article discusses about the \w vs \W in JavaScript regex. The \w and \W meta characters are used to match the characters of a given string. \w and \W are different from each other. \w (character) is equivalent to [a-zA-Z0-9_] that means it matches any single letter, number, or underscore. The characters that are not matched by the \w are matched by the \W. \W is equivalent to [^a-zA-Z0-9_] that means it matches any character other than letter, number and underscore. To match a string with a pattern, the possible methods are: string.match(pattern), string.search(pattern), pattern.exec(string), pattern.test(text). We use match ... Read More

246 Views
The ability to execute a collection of instructions or functions repeatedly while a certain condition holds true is known as looping in programming languages. The for-in statement is used to iterate through the properties of an object. This sentence will move up the prototype chain and display all inherited properties, which is usually undesirable. When it comes to iterating through array elements, there are few reasons why you shouldn't use for..in: For example, if someone changes Array.prototype, which is absolutely bad practise in code that is meant to operate well with the other scripts, for..in will cycle over all ... Read More

397 Views
We can able to access the existing object by creating its own prototype using a javascript method called "Object.create()". Using this method we can inherit the properties from the existing properties to the newly created prototype. Let's discuss it in a nutshell.syntaxObject.create(existing obj);This method takes the existing object and creates its own prototype so that the properties will be inherited from the existing object to the newly created prototype.ExampleIn the following example, Initially, an object named "person" is created and the using "Object.create" its own prototype is created and assigned to a variable "newper". Later on, using the prototype the ... Read More

212K+ Views
To convert a string into integer in JavaScript, is a simple task and can be converted using various approaches. Converting string to integer is useful for performing accurate mathematical operations, comparisons and validating user input. We will be discussing various approaches in this article to convert a string into integer in JavaScript In this article, we are having a string value, our task is to convert string to integer in JavaScript. Approaches to Convert String to Integer in JavaScript Here is a list of approaches to convert string to integer in JavaScript which we will be discussing in this ... Read More

185 Views
Boolean functionWhile developing, a developer may come across yes/no situation. At that point of time Boolean() function can be used. It results only in true or false. Let's discuss it in detail.syntaxBoolean(exp);It takes an expression and scrutinizes it and displays either true or false based on the validity of the expression.Example-1In the following example, various values have been checked whether they are true or not using Boolean() function. If any value has any legitimate value then it results in true else it results in false. var a = 0; ... Read More

2K+ Views
The Math object, a built-in object with attributes or methods for carrying out mathematical operations, has the native implementation of the random() method in JavaScript. As its name suggests, the random() method aids in the generation of random numbers. The return value of the Math.random() method is a floating-point, sort of semi number between 0 (inclusive) and 1. (exclusive). This is defined mathematically by the equation 0 = x 1. The Math.random() function will return a floating-point, pseudo-random number in the range 0 to less than 1 (inclusive of 0 but not 1) with an essentially uniform distribution throughout that ... Read More