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

kiểm tra email trong javascript

kiểm tra email trong javascript

lỗi access-control-allow-origin và cách khắc phục

lỗi access-control-allow-origin và cách khắc phục trong express, nodejs

Extend Object javascript

Extend Object javascript

Ajax, call jQuery POST to node.js expressjs

Ajax, call jQuery POST to node.js expressjs

encode/decode base64 with JS

Encoding to base64 is done with the btoa command