Category: JavaScript

  • JavaScript Interview Questions

    Introduction Javascript is an interpreted programming language. It is mainly used for the development of network-centric applications. It is a lightweight language and integrated with java. Moreover, it is integrated with HTML also, which makes its implementation easy. Javascript usage has now extended to mobile App development [in the form of React Native, etc.], Desktop…

  • JavaScript Assignments

    Assignment 1: Create a Sign-up form, with following validation: All fields are mandatory The Email Id must be valid The Phone number must be valid The Date of Birth must be in such a way that it is greater than 18 The two passwords must match (password and confirm password) HTML Code <!DOCTYPE html> <html>…

  • JavaScript Events

    JavaScript Events In our browser, anything we do is with the HTML. This HTML part has some predefined events to handle user interactions. Following are some of the HTML events: Event Description onchange This event is triggered when an HTML element has been changed onclick This event is triggered when a user clicks an HTML…

  • JavaScript Objects

    JavaScript Objects A JavaScript object is a variable which stores multiple data in the form of key and value pairs separated by a colon. This key (or name) value pair together is called property of an object. Example: An object with Employee Data var person = {firstName: “Priyanka”, lastName: “Pandey”, age: 22, education:”MCA”}; Creating an…

  • JavaScript Functions

    JavaScript Functions In JavaScript, you write all your logic within a function. A function is a block of code designed to perform a specific task. After performing its task, the function returns a result. To execute a function, we need to trigger it. In this section, we will learn how to write a function, how…

  • JavaScript Operation on Date

    JavaScript Operation on Date In JavaScript we can fetch current date and time based on the browser’s time zone. This date is displayed as a full text string. Example: Fri May 03 2019 22:22:06 GMT+0530 (India Standard Time) We can create a new Date object in given four ways: Date Object Description Example new Date()…

  • JavaScript Array

    Introduction A JavaScript Array is used to store multiple values in a single variable. Example: Array of single digit numbers myArray = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] Creating an Array An array can be created using following two ways: Using array literal var myArray = [ ]; Using JavaScript Keyword…

  • JavaScript Regular Expression (RegEx)

    JavaScript Regular Expression (RegEx) A regular expression is a collection of characters that forms a search pattern. This search pattern can be used to perform text search, text replace and text validation operations, as shown below: Operation Description Example search() We can do a case sensitive search by using an identifier i. In this case…

  • JavaScript Numeric Operation

    JavaScript Numeric Operation We have already performed several arithmetic operations on numbers till now. Apart from this, JavaScript provides following operations on numbers: Operation Description Example toString() It returns numbers as strings. var x = 123; var y = x.toString(); Output: “123” toFixed() It rounds a number to a given number of digits and returns…

  • JavaScript String Operation

    JavaScript String Operation A JavaScript String is zero or more characters written within quotes. We can perform following operations on string: Operation Description Example String Length We can get length of any string stored in a variable. Syntax: var.length Here, var can be any variable. var txt = “Gargi”; var sln = txt.length; Output: 5 Finding a String…