001this.x = 9;
002
003const moduleObject1 =
004{
005 x: 81,
006 getX: function() {
007 return this.x;
008 }
009};
010
011const moduleObject2 =
012{
013 x: 90,
014 getX: function() {
015 return this.x;
016 }
017};
018
019
020
021const retrieveX = moduleObject1.getX;
022
023console.log('logging retrieveX():');
024console.log(retrieveX());
025
026
027
028
029const boundGetX = retrieveX.bind(moduleObject1);
030console.log('logging boundGetX():');
031console.log(boundGetX());
032
033
034
035const boundGetX2 = retrieveX.bind(moduleObject2);
036console.log('logging boundGetX2():');
037console.log(boundGetX2());
038
039