How do you guys prefer writing functions?


How do you guys prefer writing functions?

I prefer writing them like:

 function functionName(input) { console.log("Example"); } 

But now I'm being introduced to methods and apparently that same format doesn't jive and I can't replace functionName with object.functionName. So generally speaking, do you guys write functions and methods all like this?:

 object.functionName = function(input) { console.log("Example"); } 

Submitted July 12, 2017 at 06:43AM by Redditor000007
via reddit http://ift.tt/2u6hCkS

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s