Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by Saurabh Jaiswal
Page 4 of 4
How to add number of days to JavaScript Date?
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 MoreHow is JavaScript an untyped language?
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 MoreHow can I remove the (//<![CDATA[ , //]]>) blocks; tags inside a script element in Javascript?
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