MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/3xiclh/4_javascript_design_patterns_you_should_know/cy4wxo2/?context=3
r/javascript • u/javascriptmyface • Dec 19 '15
6 comments sorted by
View all comments
4
TeslaModelS.prototype = function() { go: function() { // Rotate wheels }, stop: function() { // Apply brake pads } return { pressBrakePedal: stop, pressGasPedal: go } }();
Surely that definition of the go and stop functions does not work like this, because it is using the go: function syntax where it should use the var go = function syntax.
go: function
var go = function
EDIT:
Also
return : { // declare public variables and/or functions }
return : {? Surely that is invalid syntax?
return : {
4
u/[deleted] Dec 19 '15
Surely that definition of the go and stop functions does not work like this, because it is using the
go: functionsyntax where it should use thevar go = functionsyntax.EDIT:
Also
return : {? Surely that is invalid syntax?