Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

javascript Q:

Name: Anonymous 2011-10-21 20:08

is there anyway to do like

var breakln = 'document.writeln("<br />")';

breakln;

and have it actually insert a new line?

also google was of no help for this question and not much help for the next

how the fuck do i pass by reference?

Name: Anonymous 2011-10-21 21:56

If you aren't trolling. you would have to wrap the code in a function, like:


var breakln = function() {
   document.writeln("<br/>");
};

breakln();

Name: Anonymous 2011-10-21 21:58

var terpri = function(){
  document.writeln("<br />");
};


Use as: [code]terpri();[code]

Name: cocks 2011-10-21 21:58

var terpri = function(){
  document.writeln("<br />");
};


Use as: terpri();

Name: Anonymous 2011-10-22 12:32

was trying to do it without functions... guess it can't be helped

Name: Anonymous 2011-10-22 12:43

>>5
You can't do anything without functions.

Name: Anonymous 2011-10-22 13:32

Who the fuck uses document.write() nowadays

Name: Anonymous 2011-10-22 13:32

you want "breakln;" to be a meaningful statement with side effects in JS? What the hell language are you comin from son?

Name: Anonymous 2011-10-22 14:33

>>8
Pascal, probably.

Name: Anonymous 2011-10-22 15:19

You can use BreakLn(); just like you would use BreakLn;

They're interchangeable.

Name: Anonymous 2011-10-22 15:23

Don't use document.write for serious development. It triggers premature DOMReady/DOMContentLoaded in the Internet Explorer family.

Name: Anonymous 2011-10-22 15:56

( ˃ ヮ˂)

Name: Anonymous 2011-10-22 16:02

>>11`
>2011
>using Internet Explorer

Name: Anonymous 2011-10-22 16:40

You're now watching two strangers discuss your question!
Question to discuss:
What does ``love-coloured'' mean?

Stranger 1: covered in blood
Stranger 1: and sperm
Stranger 1: and piss
Stranger 2: correct
Stranger 1: and salyva
Stranger 2: sometimes shit
Stranger 1: and aids and herpes and gonhoria
Stranger 1: yes shit
Stranger 1: delicious shit

Stranger 1 has disconnected

Name: Anonymous 2011-10-22 16:46

>>13-14
Get the fuck out.

Name: Anonymous 2011-10-22 16:59

document.body.appendChild(document.createElement('BR'))

Name: Anonymous 2011-10-22 18:44

>>16
document.createElement('br').innerHTML = 'GIB MONIES?'

Name: Anonymous 2011-10-23 19:27

use cofee script

Name: Anonymous 2011-10-23 22:43

javascript
use python

Name: Anonymous 2011-10-23 23:20

python
Use Lisp

Name: Anonymous 2011-10-24 1:24

var breakln = 'document.writeln("<br />");';
eval(breakln);


But I'm trolling, so you probably shouldn't do that.

Name: Anonymous 2011-10-24 1:29

>>10

Only when using new. BreakLn is just a reference, the parens are required to actually execute the function.

Name: Anonymous 2011-10-24 3:34

use node.js

Name: Anonymous 2011-10-24 3:40

functions are first class, dummy. You can assign them to variables and/or pass them as arguments. But if you must do it your way:

eval('(' + (function() {
    // your retarded code goes in here
    document.write('line 1');
    breakln;
    document.write('line 2');
}).toString().replace('breakln', "document.write('\\n')") + ')()');

Name: Anonymous 2011-10-24 5:42

>>10

10/troll

Name: Anonymous 2011-10-24 6:26

>>24
What is up with the eval?

Name: Anonymous 2011-10-24 8:06

>>26
code = (function () { ... }).toString();
code_with_breakln_replaced = code.replace('breakln',"document.write('\\n')");
eval('('+code_with_breakln_replaced+')()');

Don't change these.
Name: Email:
Entire Thread Thread List