JS Hapus ruang sebelum string
var str = " Some text ";
str.trim();
// str = "Some text"
Gigas
var str = " Some text ";
str.trim();
// str = "Some text"
var str = " Hello World! ";
alert(str.trim());
var str=" I have outer spaces ";
var cleanStr=str.trim();//trim() returns string with outer spaces removed
let text1 = " Hello World! ";
let text2 = text1.trim();
var string = "this is a string";
var length = 7;
var trimmedString = string.substring(0, length);