JavaScript remove specific character from string
var oldString = “Test String”; var newString = oldString.replaceAll(“e”, “”); console.log(newString); // Prints ‘Tst String’ to console.
var oldString = “Test String”; var newString = oldString.replaceAll(“e”, “”); console.log(newString); // Prints ‘Tst String’ to console.
The WeakSet has() method checks if a WeakSet object contains the specified object element. Syntax: weakSetObj.has(value) Parameters: value: It represents the element to be searched. Returns: It returns true if a specified element is found in the WeakSet Object, otherwise returns false. Example: <!DOCTYPE html> <html> <body> <script> var hello = new WeakSet(); var obj={}; … Read more
The WeakSet delete() method deletes or removes an element from the WeakSet object. Syntax: weakSetObj.delete(value) Parameters: value: It represents the element to be deleted. Returns: It returns true if the specified element is removed successfully from the WeakSet Object, otherwise returns false. Example 1: <!DOCTYPE html> <html> <body> <script> var hello = new WeakSet(); var … Read more
The WeakSet add() method adds a new element to the end of a WeakSet object. Syntax: weakSetObj.add(value) Parameters: value: It represents the element to add. Returns: Updated WeakSet object. Example: <!DOCTYPE html> <html> <body> <script> var hello = new WeakSet(); var obj={}; hello.add(obj); document.writeln(hello.has(obj)); </script> </body> </html>
The JavaScript WeakMap set() method is used to add or modify the key-value pairs to the WeakMap object. The key must be unique. Syntax: WeakMapObj.set(key,value) Parameters: key: It represents the key of the element to be added or modified. value: It represents the value of the element to be added or modified. Returns: Updated WeakMap … Read more
The JavaScript WeakMap has() method to find out if the WeakMap object contains the specified value element. Syntax: WeakMapObj.has(key) Parameters: key: It represents the key to be found in the WeakMap object. Returns: It returns true if the given key is present in the WeakMap, otherwise returns false. Example 1: <!DOCTYPE html> <html> <body> <script> … Read more
The JavaScript WeakMap get() method is used to retrieve the value of a specified key. Syntax: WeakMapObj.get(key) Parameters: key: It represents the key of the element to be retrieved from the WeakMap object. Returns: It returns the value of a specified key Example 1: <!DOCTYPE html> <html> <body> <script> var hello = new WeakMap(); var … Read more
The JavaScript WeakMap delete() method deletes the specified element from a WeakMap object. Syntax: weakMapObj.delete(key); Parameters: key: It represents the element to be removed from the WeakMap object. Returns: It returns if the specified element is removed successfully, otherwise returns false. Example 1: <!DOCTYPE html> <html> <body> <script> var hello = new WeakMap(); var obj … Read more
The Javascript TypedArray toString() method transforms the element of an array into a string separated by a comma “,”. Syntax: array.toString() Returns: String. Example: <!DOCTYPE html> <html> <body> <script> var num = [“HELLO”,32,34,”WORLD”,83]; document.write(num.toString()); </script> </body> </html>
The Javascript TypedArray toLocaleString() method transforms the elements of an array into a locale-specific string. All elements of the array will be separated by a comma (,). Syntax: array.toLocaleString() Parameters: total: It represents the previously returned value of the function. currentValue: It represents the index position of the current element. index: It represents the index … Read more