Posted Wed Oct 17, 2007 @ 4:53 PM
string myStr = @"This is a C# multiline string just because I can!";
var square = new Function('x','return x*x;'); alert(square(5)); // alerts 25
var factorial = new Function('n', 'var result=1; for (var i=1; i<=n; i++) result *= i; return result;'); alert(5)); // alerts 120
var factorial = new Function('n', '\ var result = 1; \ for (var i=1; i<=n; i++) \ result *= i; \ return result; \'); alert(factorial(5)); // alerts 120
alert('foobar' == 'foo bar'); // false alert('foobar' == 'foobar'); // true alert('foobar' == 'foo\ bar'); // true!
var myStr = 'line one\n\ line two';
graffic
Posted on Wed Oct 17, 2007 @ 4:53 PM
Jovan
Jonathan
Jaja
Anonymous
Michael
rajbot
Gleb Esman
Mike
Kostov
Nentuaby
This article is old, but this should be noted for anybody else who may find it via Google:
As of ECMAScript 5, the backslash syntax has been recognized by standards. Hooray for "paving the cowpaths."
myuser
What browsers support multi-line JS strings?
stackoverflow.com/.../866206