Advertisement
gentoogames

Gleb-DataPassByReference

Jun 24th, 2022
498
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function test(_data) {
  2.     var _condition = true;
  3.     if (_condition) {
  4.         _data.name = "Alex";
  5.         _data.species = "Penguin";
  6.         return true;
  7.     }
  8.     return false;
  9. }
  10.  
  11. var _data = {};
  12. var _result = test(_data);
  13. if (_result) {
  14.     show_message(_data);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement