trim, trimStart and trimEnd methods | String Object In JavaScript

Published: 06 August 2022
on channel: Code Explained
5,615
90

🎁 Join my channel to get access to perks:
   / @codeexplained  

🧡 Hello All JavaScript Lovers Outhere!

Today you're going to learn about the String Object In JavaScript.

This tutorial is a series of videos, in each video we will discuss a method (or more) of the String Object in JavaScript.

In today's video, you're going to learn about the trim, trimStart, and trimEnd methods.

The trim() method removes whitespace from both ends of a string and returns a new string, without modifying the original string.

The trimStart() method removes whitespace from the beginning of a string. trimLeft() is an alias of this method.

The trimEnd() method removes whitespace from the end of a string. trimRight() is an alias of this method.

🟢🟠 The string.trim() string.trimStart() and string.trimEnd().
🔷 Syntax :
trip()
trimStart()
trimEnd()

🔷 Example :
const greeting = ' Hello World! ';

console.log( greeting.trim() ); // 'Hello World!'
console.log( greeting.trimStart() ); // ' Hello World! '
console.log( greeting.trimEnd() ); // ' Hello World!'

🌍 Social Media Links.
◾ Facebook :   / code.explained.official  
◾ Twitter :   / code_explained  
◾ Instagram :   / code.explained.official  
◾ GitHub : https://github.com/CodeExplainedRepo

💲 Suppport the Channel
Paypal : https://paypal.me/CodeExplained
Buy Me a Coffee: https://www.buymeacoffee.com/CodeExpl...


On this page of the site you can watch the video online trim, trimStart and trimEnd methods | String Object In JavaScript with a duration of hours minute second in good quality, which was uploaded by the user Code Explained 06 August 2022, share the link with friends and acquaintances, this video has already been watched 5,615 times on youtube and it was liked by 90 viewers. Enjoy your viewing!