jList: listInsertAt

Examples of the listInsertAt function from the jList library.

by David Waterston

HTML

<script src="https://rawgithub.com/davidwaterston/jList/master/jlist-min.js"></script>
<div id="output"></div>

CSS

#output {font-size: 30px;}

JavaScript

// listInsertAt: Inserts an element into a list.


var o = document.getElementById('output');


o.innerHTML += '1. ' + jList.listInsertAt('elem1,elem2,elem3',1,'hello') + '<br>';

o.innerHTML += '2. ' + jList.listInsertAt('cat,dog',1,'monkey','~') + '<br>';

o.innerHTML += '3. ' + jList.listInsertAt('Cat-Dog--Mouse',3,'Elephant','-') + '<br>';

o.innerHTML += '4. ' + jList.listInsertAt('5-4-3-2-1',5,999,'-') + '<br>';

o.innerHTML += '5. ' + jList.listInsertAt('',4,'abcdef') + '<br>';

o.innerHTML += '6. ' + jList.listInsertAt('',1,'abcdef') + '<br>';