Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

<<<EOF in javascript?

 
James JVogt
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
James JVogt
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Marshal
Posts: 34410
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then what's wrong with:?
 
James JVogt
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



Eric
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34410
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eric,
Cool! JavaScript works like a property file .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic