What is Join() in jQuery?

后端 未结 6 1383
无人及你
无人及你 2020-12-08 18:14

What is Join() in jquery? for example:

var newText = $(\"p\").text().split(\" \").join(\" \"); 
6条回答
  •  伪装坚强ぢ
    2020-12-08 18:56

    I use join to separate the word in array with "and, or , / , &"

    EXAMPLE

    HTML

    London Mexico Canada

    JS

     newText = $("p").text().split(" ").join(" or ");
     $('div').text(newText);
    

    Results

    London or Mexico or Canada
    

提交回复
热议问题