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