Saurabh Jaiswal

Saurabh Jaiswal

33 Articles Published

Articles by Saurabh Jaiswal

Page 4 of 4

How to add number of days to JavaScript Date?

Saurabh Jaiswal
Saurabh Jaiswal
Updated on 15-Mar-2026 19K+ Views

In this tutorial, we will learn how to add a number of days to a JavaScript Date object. Here we will discuss two methods which are following. Using the setDate( ) Method Using the getTime() Method Using the setDate( ) Method JavaScript date setDate() method sets the day of the month for a specified date according to local time. Syntax Date.setDate(dayValue) Here dayValue is an integer from 1 to 31, representing the day of the month. Approach To add a number of ...

Read More

How is JavaScript an untyped language?

Saurabh Jaiswal
Saurabh Jaiswal
Updated on 15-Mar-2026 1K+ Views

JavaScript is an untyped (or dynamically typed) language because variables can hold any data type without explicit type declaration. Unlike statically typed languages like Java, C#, C++ that require type declarations like int, char, float, JavaScript uses var, let, and const to create variables of any type. One of the key advantages of untyped languages is the flexibility to reassign different data types to the same variable during runtime. Dynamic Type Assignment In this example, we create a variable named "x" and assign different data types to it. At each step, we print the type of the ...

Read More

How can I remove the (//<![CDATA[ , //]]>) blocks; tags inside a script element in Javascript?

Saurabh Jaiswal
Saurabh Jaiswal
Updated on 15-Mar-2026 947 Views

CDATA, the short form of Character Data, is a block of code that prevents parsing by the XML/HTML parser. Sometimes our data includes predefined characters like "" + cleanedContent + ""; Using replaceAll() Method (Tags Only) The replaceAll() method can remove only the CDATA tags () while preserving the content inside. This approach is useful when you want to keep the JavaScript code but remove the CDATA wrapper. Syntax string.replaceAll("", "") Example In this example, we remove only the CDATA tags while keeping the ...

Read More
Showing 31–33 of 33 articles
« Prev 1 2 3 4 Next »
Advertisements