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

Async await in javascript

Async await in javascript

Detect when your site is visible to users

Detect when your site is visible to users

How to reverse an Array?

Reversing an array in JS is really simple with the standard array method. Like below

Random String

Random String với độ dài tuỳ chọn

promise in javascript

promise in javascript