JSFiddle - React, Tailwind, and code Playground

Array manipulation

by eggleton

HTML

<input id="stringToConvertToArrayInput" value="welcome" />
<button onclick="populateArrayElements()">Populate array elements</button>
<ul id="results">
</ul>

JavaScript

function populateArrayElements(element, index, array) {
	var string = document.getElementById('stringToConvertToArrayInput').value;
	[string].(populateArrayElements);
  //["welcome"].split('').forEach(function(v, i, a) {}
  document.getElementById("results").innerHTML = "a[" + index + "] = " + element;
}