Sự khác biệt giữa substr và substring

string,tipjs

substr() Hình thức của hàm là substr(startIndex,length). Nó startIndex trả về từ chuỗi con và trả về length số lượng ký tự.

var s = "hello";
( s.substr(1,4) == "ello" ) // true

substring()Hình thức của hàm là substring(startIndex,endIndex). Nó trả về chuỗi con từ startIndex đến endIndex - 1.

var s = "hello";
( s.substring(1,4) == "ell" ) // true

Có thể bạn đã miss một số snippets code

Rolling loading

Nguyên tắc là theo dõi các sự kiện cuộn trang và phân tích mối quan hệ thuộc tính giữa clientHeight , scrollTop và scrollHeight .

Random Number javascript

Random Number javascript

Await in a for loop

How to Await in a for loop

Spread Operator for Objects

Using the spread operator during an Object declaration will assign the properties of the referenced Object to the new Object.

Promise + gì

promise + gì