Skip to main content Accessibility Feedback

Variables, Functions, and Scope

What are arrow functions? What’s function hoisting? What’s the difference between var, let, and const, and when should you use each? What’s “scope” and how does it work? Together, we’ll apply JavaScript best practices to a working project.

📦 In Production. Pre-order now and save big!

Start learning now →

What you’ll learn

  • The difference between function expressions and function declarations, and which one to use.
  • What function hoisting is, and whether or not it’s a good thing.
  • How to scope your code, and why you want to.
  • How to conditionally set variables.
  • Useful techniques for passing variables into functions and defining default values.
  • The difference between functions and methods.
  • How to write ES6 arrow functions.
  • How to use ES6 let and const for defining variables.

Watch in streaming HD video format on any device.

I recommend Chris Ferdinandi to all JavaScript learners :) - Alex Muraro

The Project: JavaScript Best Practices

Reinforce your learning and build your portfolio by applying JavaScript best practices to a real project. Together, we’ll use everything you’ve learned about variables, functions, and scope to clean up a poorly written image lazy loading script.

You'll also get these awesome bonuses

  • All of the source code and well-documented demos so that you can see the lessons in action.
  • My vanilla JavaScript toolkit, packed with cheat sheets, code snippets, boilerplates, helper functions, polyfills, and a growing list of recommended vanilla JS plugins.
  • Exclusive access to my private Slack team, where you can chat with other students, get feedback on code, ask questions, and share the latest tips, tricks, and strategies for going vanilla JavaScript.

Start learning now →

God, you're amazing... I'm learning so much from you. Mojtaba Seyedi, Front End Developer

About the Instructor

Chris Ferdinandi

Hi, I’m Chris Ferdinandi. I write vanilla JavaScript plugins that are used by organizations like Apple, Harvard Business School, and CNN.

I want to help you master vanilla JavaScript, without all of the painful false starts and roadblocks I encountered when I was learning.

Ready to buy?

Get everything you need to start mastering modern vanilla JavaScript:

  • The Mini Course (in streaming HD video format)
  • The Source Code & Demos
  • The Vanilla JavaScript Toolkit
  • Exclusive Slack Access
  • FREE Updates for Life

Pre-order as part of the Complete Set or Beginner's Bundle and save 30% off the launch price.

Clarity. Brevity. Unpretentious explanation. Care for best practices. Obvious attentiveness. Available to help "unstuck" students. You actually rock, Chris. - Kabolobari

Frequently Asked Questions

Does the mini course include new ES6 methods?
Yes. Where applicable, I cover new ES6 functions and browser APIs. I also include polyfills when available to push browser support as far back as possible.
What happens if I buy a mini course and you release an update? Will I need to buy the new version, too?
No. You get free updates for life, sent to you by email whenever new content is available.
Can I buy a print version of the mini course?
Courses are available exclusively in digital formats. This makes it easy for you to get updates whenever new techniques, approaches, and best practices emerge. Given the rapidly changing nature of the web, this ensures you'll always have the latest and greatest version of the course.
Do you offer team discounts?
If you want to purchase more than one copy of the mini courses, email me at chris@gomakethings.com.
Do you offer a student discount?
Absolutely! This applies to anyone in any type of schooling, including evening classes and coding bootcamps. Learn more about student discounts.
I have a poor exchange rate in USD. There's no way I can afford this.
I totally get that in some countries salaries and cost of living are such that the mini courses are unaffordable. Send me an email at chris@gomakethings.com and I'll send you a discount to make it fair for where you live.
I'm not a student. Any other discounts?
Yep. I've had a lot of helping getting where I am, and I want to pay it forward. If you're a member of an under-represented group in tech, you can get special pricing. Learn more about discounts for under-represented groups in tech.
Do you have a return policy?
Absolutely! If you’re not 100% satisfied with the book, email me at chris@gomakethings.com within 30 days of purchase and I’ll give you a full refund.
If I buy just one course and love it, can I upgrade to a bundle?
Absolutely. Just send me an email at chris@gomakethings.com for a special discount code for the difference between the two packages.
I lost or never received my download link. What do I do?
Visit https://gomakethings.com/checkout/self-service and enter the email address you used to make your purchase to have your download links resent to you.
Are there any restrictions on the mini courses or source code?
Nope. I trust you to do the right thing. My content is 100% DRM free. If you'd like to share the pocket guide with others, please email me at chris@gomakethings.com for information about team pricing.
Do I need any special tools or equipment to use the mini courses?
All you need to work with the source code, projects and labs is a modern web browser and a text editor (I recommend VS Code). The mini courses come in PDF, EPUB, MOBI, and HTML formats, so you can read it on any device you own.
Do I need any prior knowledge or experience to learn vanilla JavaScript?
Ideally you're comfortable working with HTML and CSS already. Experience with another library or framework (like jQuery, React, and so on) is helpful but not required. If you're brand new to JavaScript, the guide is a great resource! If you have any specific questions, though, please email me at chris@gomakethings.com.
Are there any rules or requirements around the Slack team?
Yes. You must be at least 18 years old, and read and agree to follow the Code of Conduct.
I can't use Stripe to pay but really want to buy the mini courses. How else can I buy it?
Send me an email at chris@gomakethings.com and we'll work something out so that you're able to purchase the course.
I have another question.
No problem! Send me an email at chris@gomakethings.com.

Start learning now →

I thank you from the bottom of my heart. If it had not been for you, I would not be able to learn JavaScript. - Patricia Parker

Not ready yet? Get daily developer tips.

I send out a short email each weekday with code snippets, tools, techniques, and interesting stuff from around the web.