2 Methods to Remove Last Character from String in JavaScript

Source: https://tecadmin.net/remove-last-character-from-string-in-javascript/

Method 1 – substring function

var str= "Hello TecAdmin!";
var newStr = str.substring(0, str.length - 1);


Method 2 – slice function

var str = "Hello TecAdmin!";
var newStr = str.slice(0, -1);

Không có nhận xét nào:

Is it okay to use both fetchpriority="high" and loading="eager" in img tag?

 https://stackoverflow.com/questions/77744344/is-it-okay-to-use-both-fetchpriority-high-and-loading-eager-in-img-tag Yes Fetchpriority and l...