Advertisement
Guest User

Untitled

a guest
Jun 12th, 2013
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var examplevar = "doorknobs";
  2.  
  3. document.write(giveString()); // use () after the call as it's a function and not a variable (var)
  4. document.write(examplevar); // no () needed as it's a variable
  5.  
  6.  
  7.  
  8. document.write(mergeStrings("lel", " you suck"));
  9.  
  10.  
  11. var lel = mergeStrings("lel", "you suck");
  12. document.write(lel); // same as prev. document.write
  13. printString(lel); // same as above
  14.  
  15. printPredefinedString(); // it calls document.write itself
  16.  
  17. document.write(printPredefinedStringAndGiveMeSomethingBack()); //prints itself AND as it returns something document.write prints something valid as well
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25. function giveString() { // giving predefined string
  26.     return "pleb";
  27. }
  28.  
  29. function mergeStrings(var a, var b) {
  30.     return a + b;
  31. }
  32.  
  33. function printString(var a) {
  34.     document.write(a);
  35. }
  36.  
  37. function printPredefinedString() {
  38.     document.write("yolo");
  39. }
  40.  
  41. function printPredefinedStringAndGiveMeSomethingBack() { // as if I can come up with something better
  42.     document.write("yolo");
  43.     return "swag";
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement