printing in a single line in javascript

JavaScript
var s = "";
for(var i = 1; i < 11; i += 1) {
  s += i + " ";
}
console.log(s);
Source

Also in JavaScript: