| Author |
<<<EOF in javascript?
|
James JVogt
Greenhorn
Joined: May 21, 2007
Posts: 6
|
|
var longString = <<<EOF
blah blah blah
blah blah
EOF;
sooo does javascript have something like this? like perl and php do..?>
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56221
|
|
|
Perl and PHP are server-side templating and scripting languages. JavaScript is a client-side scripting language with no ability to access files at all. So, no.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
James JVogt
Greenhorn
Joined: May 21, 2007
Posts: 6
|
|
|
umm.... I'm not accessing a file... I'm assigning a variable to a string... that string being "blah blah blah\nblah blah\n"
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26201
|
|
James,
That's called a "here document." I don't think JavaScript has such a thing. You could try searching on "here document" to make sure.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56221
|
|
|
Then what's wrong with:?
|
 |
James JVogt
Greenhorn
Joined: May 21, 2007
Posts: 6
|
|
What happens when you have a string with lots of special chars?
var x = "blah \"blah\" blah...."; and lots of newlines that you want formatted correctly... like, say, 100 lines of text. You don't want to do a bunch of +'s, that is slow. And an array of strings then a join on it is just verbose.
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
Eric
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26201
|
|
Eric,
Cool! JavaScript works like a property file .
|
 |
 |
|
|
subject: <<<EOF in javascript?
|
|
|