JavaScript replace() method
This method searches a string for a defined value, or a regular expression, and returns a new string with the replaced defined value.
Syntax:
string.replace(searchVal, newvalue);
Parameters:
- searchVal: This parameter is required. It specifies the value, or regular expression, that is going to replace by the new value.
- newvalue: This parameter is required. It specifies the value to replace the search value with.
Return value:
Returns a new string where the defines value(s) has been replaced by the new value.
How to get current formatted date dd/mm/yyyy in JavaScript ?
In this article, we will see how to get the format current date in dd/mm/yyyy format by using JavaScript. We’re going to discuss a few methods. The first few methods to know.
These are the methods that can be used in solving this problem:
Table of Content
- JavaScript getDate() Method
- JavaScript getFullYear() Method
- JavaScript getMonth() Method
- JavaScript String slice() method
- JavaScript replace() method