To ignore a literal space, you can use regex with a space:
// get the string
let myString = getElementById("input").value;
// use / /g to remove all spaces from the string
let remText = myString.replace(/ /g, "");
// get the length of the string after removal
let length = remText.length;
To ignore all white space(new lines, spaces, tabs) use the s quantifier:
// get the string
let myString = getElementById("input").value;
// use the s quantifier to remove all white space
let remText = myString.replace(/s/g, "")
// get the length of the string after removal
let length = remText.length;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…