Guest User

Untitled

a guest
Jun 19th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. function(anInt, aString, cb, aBool=true){
  2. if(bool){...;}else{...;}
  3. cb();
  4. }
  5.  
  6. function(1, 'no', function(){
  7. ...
  8. }, false);
  9.  
  10. function(2, 'yes', function(){
  11. ...
  12. });
  13.  
  14. var variable1 = typeof variable1 !== 'undefined' ? variable1 : default_value;
  15.  
  16. function(anInt, aString, cb, aBool) {
  17. aBool = typeof aBool !== 'undefined' ? aBool : true;
  18. if(bool){...;}else{...;}
  19. cb();
  20. }
  21.  
  22. var sayMessage = function(message='This is a default message.') {
  23. console.log(message);
  24. }
  25.  
  26. node --harmony_default_parameters --eval "const t = function(i = 42) { return i }; console.log(t());"
  27.  
  28. fn1 = fn.bind(fn, 1, 'no', function(){}, false);
  29. fn1();
  30. fn2 = fn.bind(fn, 2, 'yes', function(){});
  31. fn2(true);
  32.  
  33. CoffeeScript:
  34.  
  35. fn = (bar='foo') ->
  36.  
  37. JavaScript:
  38.  
  39. fn = function(bar) {
  40. if (bar == null) {
  41. bar = 'foo';
  42. }
  43. };
Add Comment
Please, Sign In to add comment