You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a question about this Battleship code in Chapter 8. We have the model, view, controller objects; however, some functions, like helper function parseGuess() and handler functions, like handleKeyPress are not a part of the objects.
For example, why couldn't we make the parseGuess() function a method of controller object? And is init function always a stand-alone function because it needs to start everything?
Thank you so much!
The text was updated successfully, but these errors were encountered:
Possibly because those functions could be used at a later time by another js-program. However you can move the functions into the models object. Those methods will yield the same result; however you'll need to make sure you use "this." when calling them from within the object.
I have a question about this Battleship code in Chapter 8. We have the model, view, controller objects; however, some functions, like helper function
parseGuess()
and handler functions, likehandleKeyPress
are not a part of the objects.For example, why couldn't we make the
parseGuess()
function a method of controller object? And isinit
function always a stand-alone function because it needs to start everything?Thank you so much!
The text was updated successfully, but these errors were encountered: