Convert javascript array to string

前端 未结 14 901
逝去的感伤
逝去的感伤 2020-11-29 16:41

I\'m trying to iterate over a \"value\" list and convert it into a string. Here is the code:

var blkstr = $.each(value, function(idx2,val2) {                        


        
14条回答
  •  清酒与你
    2020-11-29 17:17

    Array.prototype.toString()

    The toString() method returns a string representing the specified array and its elements.

    var months = ["Jan", "Feb", "Mar", "Apr"];
    months.toString(); // "Jan,Feb,Mar,Apr"
    

    Syntax

    arr.toString()
    

    Return value

    A string representing the elements of the array.

    for more information :

    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString

提交回复
热议问题