Turn properties of object into a comma-separated list?

前端 未结 10 1929
-上瘾入骨i
-上瘾入骨i 2021-02-01 02:42

I have an object like this:

var person = {
  name: \"John\",
  surname: \"Smith\",
  phone: \"253 689 4555\"
}

I want:



        
10条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-01 03:33

    Another way is to use lodash function _.toString()

    console.log( _.toString( Object.values( person ) ) );
    ==> John,Smith,253 689 4555
    

    Check the link below https://lodash.com/docs/4.17.5#toString

提交回复
热议问题