JS rendering output string concatenation html should not have a comma

navMenuData.sort(sortID).map((item) => {
   let option;
   if (item.options) {
      let optionJSON = JSON.parse(item.options)
      option = optionJSON.map((item) => {
         return `<a href="-sharp">${item.name}</a>`
      })
   }
   let render = `<div class="category-wrap">
                      <div class="category-text-title">
                           <h5>${item.displayName}</h5>
                      </div>
                      <div class="category-text-desc">
                          ${option}
                      </div>
                </div>`
   $(".allMenuMain").prepend(render)})

console.log (option)

<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>,<a href="-sharp"></a>

how does the html of JS render output string concatenation have a comma, so what do you do with it?

Mar.05,2021

is less informative
option is an array, executing toString is equivalent to join (',') .
so if you want to use option as string splicing, do not use map .

Menu