Efficient text scroller I wrote this small test, i would love to know if it's possible to achieve the same result in a more "efficient" way, before any moderator closes this question, it's not subjective because my defention of efficient here means less lines of code, and less memory usage.

Here is a Demo : 
http://jsfiddle.net/YsjLp/

and here is the JS code : 

var position = 0;
var divToEdit = document.getElementById('here');

function executeIt(){
    setInterval(function(){moveIt()},300);  
}

function moveIt(){
    var textToInsert = '';
    var textLength = 10;

    for (var i = 0; i &lt;= textLength; i++) {     

        if(i == position){                      
            textToInsert += '[-]';      
        }else{
            textToInsert += '-';    
        }       
    };  

    if(position == textLength){
        position = 0;
    }else{
        position += 1;
    }

    divToEdit.innerHTML = textToInsert;
}   

executeIt();
As you define efficient to be "less lines of code", here it is:

function moveIt(){
    var textToInsert = '';
    var textLength = 10;

    for (var i = 0; i &lt;= textLength; i++)
        textToInsert+= (i==position)?'[-]':'-';
    (position==textLength)?position=0:position++;
    divToEdit.innerHTML = textToInsert;
}


Demo: http://jsfiddle.net/YsjLp/3/