Accessing JavaScript array elements- JavaScript arrays are zero-based indexed. In other words, the first element of an array starts at index 0, the second element starts at index 1, and so on. To access an element in an array, you specify an index in the square brackets []: The following shows how to access the elements of […]
Category: JavaScript
Remove a specific item from an array JavaScript– The splice() method changes the contents of an array by removing existing elements and/or adding new elements. Code to Remove a specific item from an array JavaScript-
Yesterday date in javascript- The setDate() method sets the day of the Date object relative to the beginning of the currently set month.If the dayValue is outside of the range of date values for the month, setDate() will update the Date object accordingly. Use this code to Get yesterday date in javascript-
Get the current date in JavaScript- JavaScript Date objects represent a single moment in time in a platform-independent format. Date objects contain a Number that represents milliseconds since 1 January 1970 UTC. The Date() constructor creates a new Date object with the actual time value. Code Get the current date in JavaScript-
Get yesterday’s date in javascript- The setDate() method sets the day of the Date object relative to the beginning of the currently set month. Code to get yesterday’s date in JavaScript- Result:
Month name from date in javascript- The toLocaleString() method returns a string with a language sensitive representation of this date. Use Below code to get month name from date in JavaScript–
Base URL in JavaScript- You can access the current url quite easily in JavaScript with window.location You have access to the segments of that URL via this locations object. For example:-