Hướng dẫn conditional string concatenation javascript - javascript nối chuỗi có điều kiện
Phương thức Bài viết này được đăng tại freetuts.net, không được copy dưới mọi hình thức.freetuts.net, không được copy dưới mọi hình thức. Phương thức Cú pháp: Trong đó: Bài viết này được đăng tại [free tuts .net]
Cách sử dụngVí dụ: sử dụng phương thức
Kết quả Học lập trình miễn phí tại freetuts.net Tham khảo: w3schools.com Phương thức concat() dùng để nối hai (hoặc nhiều) chuỗi lại với nhau thành một chuỗi.concat() dùng để nối hai (hoặc nhiều) chuỗi lại với nhau thành một chuỗi.Cú pháp:
Xem ví dụ The Học lập trình miễn phí tại freetuts.net0 method concatenates the string arguments to the calling string and returns a new string. Học lập trình miễn phí tại freetuts.net0 method concatenates the string arguments to the calling string and returns a new string. Try itSyntax
ParametersHọc lập trình miễn phí tại freetuts.net1 One or more strings to concatenate to Học lập trình miễn phí tại freetuts.net2. Return valueA new string containing the combined text of the strings provided. DescriptionThe Học lập trình miễn phí tại freetuts.net0 function concatenates the string arguments to the calling string and returns a new string. Changes to the original string or the returned string don't affect the other. If the arguments are not of the type string, they are converted to string values before concatenating. The Học lập trình miễn phí tại freetuts.net0 method is very similar to the addition/string concatenation operators ( Học lập trình miễn phí tại freetuts.net5, Học lập trình miễn phí tại freetuts.net6), except that Học lập trình miễn phí tại freetuts.net0 coerces its arguments directly to strings, while addition coerces its operands to primitives first. For more information, see the reference page for the Học lập trình miễn phí tại freetuts.net5 operator. ExamplesUsing concat()The following example combines strings into a new string.
Specifications
Browser compatibilityBCD tables only load in the browser See also |