JavaScript split will split the string with passed parameters into array. Two parameters a) split character b) no of split. See the code split:
<!DOCTYPE html>
<html>
<head>
<title>Welcome to LearnKode - A code learning platform</title>
</head>
<body>
<button onclick="splitString()">Show the split values</button>
<p id="sample"></p>
<script>
function splitString() {
var str = "I Love LearnKode";
var result = str.split(" ");
document.getElementById("sample").innerHTML = result;
}
</script>
</body>
</html>