Rahul Sharma has Published 54 Articles

How to format a JavaScript date?

Rahul Sharma

Rahul Sharma

Updated on 16-Jun-2020 13:32:45

JavaScript date follows the formatting formats −Date TypeFormatISO Date"2017-11-29" (The International Standard)Short Date"11/29/2017"Long Date"29 Nov 2017"Full Date"Wednesday November 29 2017"ExampleHere’s how you can display current date −Live Demo           Click below to get the current date:       Display Date       ... Read More

What is boxing and unboxing in Java?

Rahul Sharma

Rahul Sharma

Updated on 16-Jun-2020 10:14:55

Wrapper classes are those whose objects wraps a primitive data type within them. In the java.lang package java provides a separate class for each of the primitive data type namely Byte, Character, Double, Integer, Float, Long, Short.Converting primitive datatype to object is called boxing.ExampleInteger obj = new Integer ("2526");Whereas, converting an ... Read More

How to include an external JavaScript inside an HTML page?

Rahul Sharma

Rahul Sharma

Updated on 15-Jun-2020 11:48:03

The HTML tag is used for declaring a script within your HTML document. Through this, you can define client-side JavaScript. But, what if you want to add external JavaScript inside an HTML Page? Well, you can easily do that too using the src attribute of the tag.The following ... Read More

How to Delete Bookmarks in your Browser (Firefox, Chrome)

Rahul Sharma

Rahul Sharma

Updated on 15-Jun-2020 08:51:40

Bookmarks in a web browser are saved so that it can be referred. It is also known as favorite web pages. To Bookmark a web page, visit the page and press Ctrl+D. This will give you an option to save the web page.In this way, all the bookmarks get saved ... Read More

How to choose an HTML Editor?

Rahul Sharma

Rahul Sharma

Updated on 15-Jun-2020 08:27:06

HTML Editors are WYSIWYG editor program which gives options to edit source code. Some of the well-known editors include Adobe Dreamweaver, CoffeeCup, KomodoIDE, EditPlus, etc. To choose an HTML Editor, you need to compare some of the features and find the best one to edit the source code.While choosing and ... Read More

Why avoid increment (“++”) and decrement (“--”) operators in JavaScript?

Rahul Sharma

Rahul Sharma

Updated on 15-Jun-2020 05:41:11

The increment and decrement operators should be avoided since it can lead to unexpected results. Here are some of the conditions:In an assignment statement, it can lead to unfavorable results:ExampleLive Demo                    var a = 5;          var ... Read More

How to check a not-defined variable in JavaScript?

Rahul Sharma

Rahul Sharma

Updated on 15-Jun-2020 05:26:32

To check a variable is ‘undefined’, you need to check using the following. If the result is “false”, it means the variable is not defined. Here, the variable results in “True” −ExampleLive Demo                    var points = 100;             if(points){                document.write("True");             }else{                document.write("False");             }          

What are Assignment Operators in JavaScript?

Rahul Sharma

Rahul Sharma

Updated on 15-Jun-2020 05:24:34

Using Assignment Operators, you can assign a value to a variable. JavaScript supports the following assignment operators −Sr.NoOperator and Description1= (Simple Assignment )Assigns values from the right side operand to the left side operandEx: C = A + B will assign the value of A + B into C2+= (Add ... Read More

How do you check if a variable is an array in JavaScript?

Rahul Sharma

Rahul Sharma

Updated on 13-Jun-2020 13:24:23

To check if a variable is an array, use “instanceof. The following is the syntax −variable instanceof ArrayExampleLet’s seen an example to check if the variable “sports” is an array or not?                       var sports = [ "tennis", ... Read More

What are Logical Operators in JavaScript?

Rahul Sharma

Rahul Sharma

Updated on 13-Jun-2020 12:55:29

JavaScript supports the following logical operators. Assume variable A holds 10 and variable B holds 20, then, Sr.NoOperator and Description1&& (Logical AND)If both the operands are non-zero, then the condition becomes true.Ex: (A && B) is true.2|| (Logical OR)If any of the two operands are non-zero, then the condition becomes ... Read More

Advertisements