Search code examples
javascriptarrayselement

Making the element of an array containing double quotes


How do you make this the whole lot,

<input type="text"/> <input type="range" min="-50" max="50" step="10" value={val} onChange={e => setVal(e.target.value)}/> {val}
 <br></br>

the element of an array? The problem is it contains double quotes but the element is surrounded by double quotes.


Solution

  • You can use single quotes for an array.

    var a = ['<input type="text"/> <input type="range" min="-50" max="50" step="10" value={val} onChange={e => setVal(e.target.value)}/>{val}<br></br>']