str.trim()
1st October 2023
0 Comments
Programming Language
JavaScript [Version: ECMAScript (ECMA-262)]
Examples of str.trim()
let myName = " Brinley Pavitt ";
console.log(myName.trim());
The above will log “Brinley Pavitt” to the console, deleting all whitespace from the beginning and the end of the string. The whitespace between characters remains intact.
Used In Projects
Was This Helpful?
If this post has helped you, please let me know. Your feedback will be highly appreciated and will help me build better content.