var string = 'my stroka N1\nmy stroka N2\nmy stroka N3'; Array.prototype.forEach.call(string.split('\n'), function (a) { console.log(a); alert(a); });