Created
March 28, 2015 15:02
-
-
Save MarkLavrynenko/7806b0f1ae74b7193eb3 to your computer and use it in GitHub Desktop.
Js Symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Schedule (pretend, real) { | |
this.morning = pretend["morning"]; | |
this.evening = pretend["evening"] | |
var morning = Symbol("morning") | |
var evening = Symbol("evening") | |
this[morning] = real["morning"]; | |
this[evening] = real["evening"]; | |
this.printTruth = function(){ | |
var truth = { | |
morning : this[morning], | |
evening : this[evening] | |
}; | |
console.log(truth); | |
} | |
} | |
var pretend = { | |
morning : "sport", | |
evening : "family" | |
} | |
var real = { | |
morning : "vodka", | |
evening : "weed" | |
} | |
var daySchedule = new Schedule(pretend, real); | |
console.log(daySchedule) | |
daySchedule.printTruth() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment