Demo of Creating Array from a string

Here is the string used

( refresh this page to check again )

The code is here

<div id='a2' style=" background-color: #cccc33;" ></div>

<script type="text/javascript">
var str="this is my new tutorial";
document.getElementById("a2").innerHTML= str;
function create_array(){
var a1 = new Array();
a1=str.split(" ");
document.getElementById("a2").innerHTML= a1.join(" <br> ");
<input type=button value='Create Array' onClick='create_array()';>

Subscribe to our YouTube Channel here


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here

    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 All rights reserved worldwide Privacy Policy Disclaimer