JavaScript Tutorial For Beginners #20 – Functions

Hey class, so in this JavaScript tutorial I want to introduce you to the world of functions. Yep, I think you’re ready for them :). Functions allow you to chunk parts of code together into logical sections, and call that code at any time. For example, you may have a function to cycle through all of your images on a web page, and implement a zoom functionality on the. You’d probably call this function something like imageZoom.

So, functions are a really cool and integral part of JavaScript, and something you should try and get into the habit of using early on in your JavaScript development, so that your code is always readable and tidy for yourself and other developers.

At first, functions in JavaScript can be a tricky concept, so by all means fire away with any questions you have down below :).


========== JavaScript for Beginners Playlist ==========

========== CSS for Beginners Playlist ==========

========== HTML for Beginners Playlist ==========

========== The Net Ninja ============

For more front-end development tutorials & to black-belt your coding skills, head over to – or

========== Social Links ==========

Twitter – @TheNetNinja –


Eduardo Bianchi says:

why do you used the return thing to average? didn’t understand that part, what woudl happen if you just put return?

Bruno Morais says:

why does brackets keep giving me error in the words document and console? it says they are not defined

lardosian says:

could you say ‘var myResult = average’;

Md Rohim Sikder says:

nutshell mean in your video? Nice video and great explanation…………………….

Desig9stein says:

Thanks for the tutorial, this is the best explanation that i found so far. I will definitely recommend you channel

daren tan says:

Hi there, thank you for the video upload. May I ask what does “return” do? When is it necessary to include “return”?

Thank you!

Harman Jolly says:

why doesnt myresult hv hv dese () in console.log like myresult();

ProPavGaming says:

At around three minutes in, could you have the “average” variable as a local variable? Then in the code block, you can just say “average = (a + b) / 2”?

Write a comment


Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.

Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!

Send this to a friend

▷ Other ReviewsVehicles   Show Cars   Motorbikes   Scooters   Bicycles   Rims & Tires   Luxury BoatsFashion   Sunglasses   Luxury Watches   Luxury Purses   Jeans Wear   High Heels   Kinis Swimwear   Perfumes   Jewellery   Cosmetics   Shaving Helpers   Fashion Hats   Modeling TipsFooding   Chef Club   Fooding Helpers   Coktails & LiquorsSports   Sport Shoes   Fitness & Detox   Golf Gear   Racquets   Hiking & Trek Gear   Diving Equipment   Ski Gear   Snowboards   Surf Boards   Rollers & SkatesEntertainment   DIY Guides   Zik Instruments   Published Books   Music Albums   Cine Movies   Trading Helpers   Make Money   Fishing Equipment   Paintball Supplies   Trading Card Games   Telescopes   Knives   Vapes   GameplaysHigh Tech   Flat Screens   Tech Devices   Camera Lenses   Audio HiFi   Printers   USB Devices   PC Hardware   Network Gear   Cloud Servers   Software Helpers   Programmer Helpers   Mobile Apps   Hearing AidsHome   Home Furniture   Home Appliances   Tools Workshop   Beddings   Floor Layings   Barbecues   Aquarium Gear   Safe Boxes   Office Supplies   Security Locks   Cleaning ProductsKids   Baby Strollers   Child Car Seats   Remote ControlledTravel   Luggages & Bags   Airlines Seats   Hotel Rooms   Fun Trips   Cruise Ships   Mexico Tours