As we saw before, JavaScript code is run in your browser to make things move on your web page and allow users to interact with it. Examples of the functionality that JavaScript offers include drop-down menus and hover effects, which you see on web pages all the time. It's time to dive deeper and start getting your hands dirty with some code.
This is also the first time you'll get to do some actual programming (HTML/CSS doesn't count because it just kind of sits there). It should be fun! You'll learn concepts (like, say, conditional statements) that are used in every programming language you'll ever learn, including Ruby. JavaScript just happens to let you implement them to do fun things in the browser.
This lesson will tend to focus on understanding the programming side of JavaScript, while the next lesson on jQuery will build on the knowledge you gain here to allow you to interact with the elements on your web page.
Look through these now and then use them to test yourself after doing the assignment
- What is a scripting language?
- What is a variable?
- What are strings, arrays and booleans?
- What are events?
We are in the process of completely revamping and rewriting our JavaScript content. The material that would replace the lessons found here in the WebDev101 course is pretty much complete. Right now, we are looking for students to test it out for us! Your feedback is crucial to making it as good as possible. If you're interested, you can find the new content here.
- Do Codecademy's JavaScript course for a good overview of the basics of JavaScript.
- Go to jsfiddle.net and play around with their tool. It lets you type out some HTML, CSS and JavaScript, and see the result displayed for you right there. It's great for just testing things out or solving simple problems, though it will feel a bit clunky if you're trying to do a whole project in it. Hit the "Run" button at the top to run your JavaScript.
- Another in-browser IDE to explore for HTML/CSS/JavaScript is codepen.io.
- You can also try the JavaScript section of repl.it. It doesn't support HTML and CSS, but it does provide you with a helpful JavaScript console.
- Start thinking about how to use code to solve more logical problems. As much as web development is an expression of creativity, it's also based on problem solving (and job interviewers certainly know that) so you'll want to shake the rust off that part of your brain. Project Euler is a series of programming challenges that are best solved by using the power of computers (since many of them require you to perform simple mathematical operations on a very large scale). Some of the later problems require so much repetition and computing power that you would need to find a more elegant way of solving it than the immediately obvious "brute force" solution. We'll just go through the first one now; it's all we need at this point. Solve these problem in repl.it if you aren't comfortable working with your own files:
- Problem 1: Multiples of 3 and 5. Go ahead and read the assignment. Now, let's break it down into a few steps. The first thing we have to know is how to check if a number is a multiple of 3 or 5 (in case you don't remember, a multiple of a number is that number multiplied by an integer). Hint: modulus operator. Next, we need to sum all the numbers that are multiples, so we'll need a variable to keep track of that sum. And lastly, we need to iterate (remember how to do a loop in JavaScript?) through all the numbers until we get to 1000. With all this, we should be able to solve the problem. In case you are still struggling, check out other students' solutions for inspiration.
- If you feel like it, go and solve a few more problems! No one said you could turn off your brain!
- There's a lot of power in your browser's DevTools for debugging and working with JavaScript code. The official DevTools docs are a pretty good resource for getting started and digging in. This video from Wes Bos also has some pretty great tips for working with JavaScript in the browser.
Submit a link to your GitHub repo here with a pull request. Please include your partner's GitHub handle somewhere in the description if they would like attribution.
- Add your solution below this line!
- Lucas Bicudo's Solution for problem 1 - View in browser
- Alex's Solution for problem 1 - View in browser
- Clifford Minks's solutions 1, 2, and 3 - View in browser
- Nate Dimock's Solution for Problems 1 & 2
- iamfranco's Solution for problem 1 - View in browser
- Alfredo's Solution for problem 1
- Mohammed Mahdi's solution to problems 1-2
- Dmitriy's solution to problems 1-2
- Ozra's solution to problems 1-7
- Freya's solution to problem 1
- Maria Tikhonova's solution to problem 1
- Chris's interactive challenge 1 solution - View in browser
- Alin Simion's solution to problem 1
- danhofer's interactive solutions - View in browser
- dgwn's Solutions
- Ed Magalhaes's Solutions for problems 1 and 2
- Jon Motyka's Solutions for problems 1 and 2
- Thanan's Solutions for problems 1 & 2
- Franklyn Afeso's Solutions for Problem 1 & 2 - View in Browser
- Jonathan Yiv's Solutions
- Simon Greenwood's solution to problem 1 & 2
- htmercury's solution for problem 1 - View in browser
- Mark Ballard's solution for problem 1 - View in browser
- Henrike Martxa's solution for problem 1
- Joyce's solution for problem 1
- Akshat Dubey's solution to problem 1,2,3 and 4 (with variable inputs) - View in browser
- Ivan Marquez's solution to problem 1 and 2
- cj-sv's solution to problem 1 and 2
- oheydrew's solution for problems 1 & 2 - View in browser
- Bn8's solution for problem 1 (variable input option) - View in browser
- Barry's solution for problem 1
- endotnick's solutions
- egealpay's solution for problem 1
- GuyInALabCoat Solutions for problems 1-4
- KP's solution to Problems 1 and 2
- sbadillo solution euler
- Takyawn's solution to problem1
- kuehlr92's solution to problem 1
- willievantonder's solution to Problem 1
- EK's solution to Problem 1
- Kasey Z.'s solution for problem 1
- Aditya's solution for problem 1
- Breadbear's solutions for problems 1 and 2
- Charalamboss solution for problem 1
- Joshua Marcelo's solution for problem 1
- Nicholas Montefusco's solution for problem 1
- Gokul Krishnan's solution for problems 1-5
- Chris Kessell solution for problems 1 & 2
- Katherine Hanson's solutions for problems 1 & 2
- Ana Sommer's solution
- smimimi's solutions for problems 1-3
- Ben Deltenre's solutions
- Lorrie Pearson's solution
- aznshents' solution
- Grey Ghost's solution - View In Browser
- Davand88 solution for Multiples of 3 and 5
- Andrei Cirlan Solution for Multiples of 3 and 5
- Mike's Solution for Multiples of 3 and 5
- xavier solution for problem 1
- Demo318's solution for problems 1-2
- AntonyOtero's solution for problem 1
- Adong520's solution for problem1
- holdercp's solution for problems 1-3
- dennzimm's solution for problem 1-5
- ericaddison's solutions for problems 1-5 - View in browser
- Tharyck21's solutions for problem 1-3
- Putra Isyraq's solutions for Problem 1 & 2
- Avoup's solutions 1 & 2
- FedeZeta's solutions
- Xushiqing's solution to problem 1
- Stanley Quek's solution to problem 1-3
- Tarelochkin's solution to Problems 1-3, 7
- ryan_'s solution to Problem 1
- danielbyun's solutions to Problem 1
- clormor's solutions
- sharkbite1414's solution
- Shafkathullah's solution to Problem 1
- Lisa patel's solutions to Problems 1
- richjdsmith's solutions to Problems 1
- jgwould's solutions to Problems 1 & 2
- ugitch's solutions - View in Browser
- sofiegraham's solution to Problems 1, 2 & 3
- Damian's solution to Problem 1
- mazen.j's solution to problem 1 & 2
- theghall's solution to Problem 2
- theghall's solution to Problem 1
- Rajat Dhyani's solution to Problem 1 & 2 - View in Browser - (Interactive!)
- kookfromleduc's solution to Problem 1, 2, & 3
- mrjsykes's solution to Problem 1
- 0elo's solution
- Kboy's solution - View in browser
- Sanya Verma's solution
- Sherman Bowling's solution to 1 & 2
- Alexander Chalk's solution
- Aarti's Solution to 1 & 2
- Vipin Sharma's solution - View in browser
- Bánk Mészárovits's solution
- Chad Kreutzer's Solution
- Robert Richards' Solution - View in browser
- RebootJeff's solution
- mattphoto's solution
- Neil Gehani's solution
- Marina Drigo's solution
- Lamberto Diwa's solution - View in browser
- Jeffery Garza's solution
- Afshin Mokhtari's solution
- Jamie's solution
- Sergey Prihodko's solution
- Angel Vargas's solution - View in browser
- Abrar Hussain's solution - View in browser
- Sahil Agarwal's solution
- Chris Everett's solution
- Joe Barratt's solution
- Ruben Mendez's solution
- Ingi Kim's solution
- Tommy Noe's solution
- Jason Ellis's solution
- Donald's solution
- Yeon Seo's solution
- Stephanie's solution
- Conor Foley's solution
- Benjamin Ratiarisolo's solution - View in browser
- John Miller's solution
- Farkhod Karimov's solution
- David Ford's solution
- James MacIvor's solution
- Colonel Bookclub's solution
- Roman Davis's solution
- Julie De Lorenzo's solution
- Khaled Maher's solution - View in browser
- Dorian Iacobescu's solution - View in browser
- John Quarles' solution
- Eric Rohver's solution
- Rafael Ruiz Moreno's solution
- M.Musab Sohail's solution
- Antonio Augusto's solution - View in browser
- Lara Finnegan's solution - View in browser
- Vidul's solution
- Rebecca Appleyard's solution
- Panagiotis Karatakis' solution
- Julian De Ocampo's solution
- Chris Dziewa's solution
- Akshay Kumar Bhushan's solution
- Richard Stewart's solution - View in browser
- Eleanor Weigert's solution
- Alice Rhomieux's solution
- Jitendra Jogeshwar's solution
- Andrea Kulbaba's solution - View in browser
- Asish Prabhakar's solution
- Sami Bashraheel's solution
- Tyler Traver's solution
- Ricardo Villegas' solution
- Dominik Stodolny's solution
- Jeremy Faith's solution - View in browser
- Kate McFaul's solution
- Kevin Weir's solution
- Dan McCallum's solution
- Matus Karahuta's solution
- Patrick Sullivan's solution
- Tommy Rodriguez's solution
- Benjamin Wilhelm's solution
- Adam Lecuyer's solution
- Zane Bilous's solution
- Thomas Vaeth's solution
- Taylor Buchheit's solution
- Robert Juall's solution
- Nicole Wong's solution - View in browser
- Josh Klein's solution
- Trump's solution
- Michelle CV's solution
- Micah Obal's solution
- Sarah McManus' solution
- Eddie's solution
- Gb69010p's solution
- Jason's solution
- Rob Pennington's solution
- Sandeep Navghane's solution
- Alex Perez's solution
- Prashanth Chandra's solution - View in browser
- Brendon's solution
- Maia Petee's solution
- Matthew's solution
- Vlad Romeo's solution - View in browser
- Dan Hoying's solution
- Swati Kumar's solution
- Jeremy Mauzy's solution
- SiriusBlak's solution
- Mateusz Staszczyk's solution
- Jason Symons' solution
- Bob Blake's solution
- Chris Fullinwider's solution
- Tony Vumbaca's solution
- Arshaan Bhimani's solution
- Glenn Crosby's solution - View in browser
- Karl Keller's solution
- Nick Foster's solution
- ninja-ml's solution
- Tarun Johnson's solution
- ll14m4n's solution - View in browser
- A.Caroline's solution
- Brody West's solution
- Shawn Stovall's solution
- Seth Hall's solution - View in browser
- M.Edgar Joel's solution
- Alex Tsiras' solution
- Cory Graddy's solution - View in browser
- Mark Viola's solution
- Patrick Doane's solution
- JTomlin's solution - View in browser
- Thulasi Arasu's solution
- Joseph McConnell's solution
- Adrian Clark's solution
- Kevin Sen's solution
- Connor Allen's solution - View in browser
- Scott Bobbitt's solution
- Joe Balsamo's solution
- Gerard Jorgensen's solution
- laingdk's solution
- Jeffrey Bartels' solution
- musyilmaz's solution
- Siddharth Gupta's solution
- impossibleshapes' solution
- Florian Mainguy's solution
- Francis Ngo's solution - View in browser
- Panashe Fundira's solution
- Brian Burke's solution
- Pratheeksha's solution
- Davis Campbell's solution
- Adrian Manteza's solution - View in browser
- Dago Henriquez's solution - View in browser
- Chris Watland's solution
- Adan Camacho's solution
- Noah Prescott's solution
- Chris Swanson's solution- View in browser
- Calandra Z's solution -View in browser
- Dylan Bailey's solution
- Paweł Cichoń solution - View in browser
- Parker Boyes' solution
- Jacob Stoebel's solution
- Chris Avery's solution - View in browser
- Giacomo R's solution - View in browser
- Moiz Hasan's solution
- Harvey Singh's solution
- Kirk D. Shelton's solution-View in Browser
- Kelvin Stone's solution - View in browser
- Ismaeel Ali's solution - View in browser
- Prayatna's solution
- Petros Kalogiannakis's solution - View in browser
- Austin's solution
- Pablo Bordons Estrada's solution
- Javeed Ishaq's solution
- Joe Pfohl's solutions:
- Porx's solution
- Defgarden's solution - View in browser
- Dush's Solutions
- CodeRobot's solution
- Alo Tauaese's solution
- Mitch Conquer's solution
- Dennis Lin's solution
- Corey Kazaks' solution
- Sarabeth's solutions:
- Andrea L's solution - View in browse
- Adrian Szima's solution
- Jason Harris' solution - View in browser
- Pras Kumar's solution
- Angel A. Martinez's A. solution - View in browser
- Adrian Szima's solution
- KarChun C's solutions:
- Chethan Bhat's solutions:
- Bas Langenberg's solution - View in browser
- Michael Sotkin's solutions:
- Francisco Carlos da Silva's solutions
- Giorgos Mitsis's solution - View in browser
- Masha Z's solutions
- Francisco Carlos da Silva's solution
- Troy Hubbell's Solution
- Ethan Harner's Solution - View in browser
- Richard Rosario's Solutions
- Karol Wójcik's Solution
- John Loudon's Solution
- Andrew Park's Solution - View in browser
- Jason Bialick's Solution - View in browser
- Prakhar Gautam's Solution
- Gabriel Ramos' solution - View in browser
- DV's Solution
- David Atcheson's Solution - View in browser
- Jerrell Bryant's Solution - View in browser
- Skye Free's Solution - View in browser
- John Smalley's Solution
- Piotr Ejsmont's Solution
- Jake Hill's Solution
- Kelly Downes' Solution
- Terrib1e's Solution - View in browser
- Andrew Johnson's Solution - View in browser
- Dominik Chomicki's Solution - View in browser
- Andrea Marongiu's Solution - View in browser
- Miguel Herrera's Solution
- Cody Cooper's solution - View in browser
- Matt Velez' Solution
- Eric Hu's Solution
- CodyLBuffaloe's Solution
- Miles Rose's Solution
- Calvin Colson's Solution
- Lisa Dean's Solution
- Jean Merlet's Solution - View in browser
- Tom Westerhout's Solution - View in browser
- Tahmid's solution - View in browser
- Swordscoper's solution - View in browser
- K4koffi's Solution - View in browser
- Finnishmiko's solution - View in browser
- Leo Soai-Van's solution
- YogAzathoth's solution
- Jess Farley's solution - View in browser
- Michał Kopeć's solution - View in browser
- Brian Flatt's solution
- Earth35's solution - View in browser
- Kevin Biddle's solution - View in browser
- Pauline Judge's solution
- Michael W's solution
- mattie rae's solution
- Pranav Anurag's solution
- Nazim's solution
- Andrew W's solution
- Marie Sheridan's solution - View in browser
- Solutions by SEGH
- Chris B's solution
- Ramon Reyes's solution - View in browser
- ryanpaixao's solution - View in browser
- Peter Taggart's Solution
- Marceia Egler's solution - View in browser
- Armin Zierlinger's solution - View in browser
- MLT-SRG's solution - View in browser
- Derek Scace's Solution
- Lawrence Lin's Solution - View in browser
- Brandon Phillips's Solution - View in browser
- Ryan Clarke's Solution
- Gitnik's Solution - View in browser
- Oscar Y's Solution
- Arkhans's Solution
- John Gerakaris's Solution
- Monique E's Solution - View in browser
- Greg Pritchard's Solution - View in browser
- Rob Harkness's Solutions - View in browser
- John Sawyer's Solution
- Jorge Gonzalez's Solution
- ttchopper's Solutions
- Nijastan Kirupa's Solution - View in browser
- Johnny Rasnic's Solutions
- Fabricio Carrara's Solution - View in browser
- joelmarvi's solution
- james harder's solution
- Cornelius Edward's Solution - View In Browser
- Singh Satnam's Solution - View in browser
- Josh Cummings' Solutions
- Derek Kwong's Solutions
- Starscream87's Solutions - View in browser
- belalik's Solutions - View in browser
- at0micred's Solutions
- Murray Berkowitz's Solutions - View in browser
- Spoon And Birdcage's Solution
- Paulo E. Aquino's Solutions
- Deepak's Solutions - View in browser
- Alexander Amirov's solution - View in browser
- John Connor's solution - View in browser
- Bruno Nascimento's solution - View in browser (Interactive!)
- Tyler K. Solutions
- Jason Keeney's solution - View in browser
- Shala's Solutions
- Orlando Camargo´s solution
- Kevin Hongtongsak's solution
- Lani Huang's solution
- haR's solution
- Luján Fernaud's solution - View in browser
- Mason Embry's Solutions
- Ricardo Ferreira's solution - View in browser
- Jessica G. Solutions
- Dennis Lee's Solutions
- Fred Rhae's solution - View in browser
- Solution by Andrew Artajos
- Promethea Oue's solution
- Garrison Shea's solution - View in browser
- Veselin Ivanov's solution
- jqguess solution
- Ace Cassidy's solution
- Alina Solodnikova's solution - View in browser
- John Alcher's solution
- Seiji's solution
- Tom Bell's solution - View in browser
- Henry Tran's solution
- Kelly Williams' solution
- Henry the Dj's solution
- Marc Sanmiquel's solution
- Todd Demone's solution
- sdo91's solution - View in browser
- Vanessa Tan's solution
- Boris Muminovic's solution
- Dave Smith's solution - View in browser
- Sparwoman's Solution
- Raiko Murulauk's Solution
- Zach Beaird's Solution - View in Browser
- Karthik's Solution - View in browser
- tcapre01's Solution
- Harsha's Solution
- Lien's Solution - View in browser
- Martin's Solution
- Usman Akhter's Solution
- Matthew Chan's Solution
- Austin Tinsley's Solution
- Bruno Oliveira's Solution
- NIblu's Solution - View in browser
- Steve Howard's solution - View in browser
- Aristotelis Leventidis's solution
- Eduardo Peixe's Solution
- Loris Aranda's solution - View in browser
- Paul Merrigan's solution
- husein ghafari solution of euler prime number project
- Chris Chambers' Solution - View in browser
- Mike Coon's Solution
- Justin Lam's Solution
- Rebekah Samorano's Solution
- grzegorzzajac1989's Solution
- Yorick's Solution - View in browser
- Allen Yin's solution
- Will Chellman's solution - View on jsfiddle
- Benjamin's solution
- Cicero Ferreira's solution
- Benjamin's solution
- Harsimran Mann's Solution
- Jakub Augustyn'n Solution - View in browser
- Zapad Daniel Solution
- Travis Gibson's Solution - View in browser
- biko's Solution
- Ryan Barnett's Solution - View in browser
- Richard Shipe's Solution
- Franz Asperger's Solution -View on Codepen
- Melissa Koski's Solution
- Moshe Itzhaki's Solution -View in browser
- Sophia Wu's Solution -View in browser
- Anders Pico's Solution
- Vaclav Skvaril´s Solution - View in browser
- Harry Maher's Solution
- Parker Brown's Solution
- EnXo's Interactive Solution - View in Browser
- Curtis Barnard's Solution
- Tim Lapinskas's Solution
- jeff1st's Solution
- Christopher Ivan's Solutions
- Behdad Analui's Solutions
- N00bG1rl's Solution
- Samuel Langenfeld's Solution - View in Browser
- Ian Arsenault's Solution
- Eren Cataltepe's Solution
- Josh Vogel's Solution - View in Browser
- Adrian Vasquez's Solution
- Bill Hefty's Solution - View in Browser
- Jib's Solution - View in Browser
- Carlos Jimenez's Solution - View in browser
- Stefan P's Solution
- Lawrence Lawson's Interactive Solution - View in Browser
- Dustin Seright's Solution - View in Browser
- Boscardin's Solution
- Øistein Haugland's Solution - View in Browser
- Yury Tomilin's Solution
- Oliver Potter's Solution
- Siker001's Solution
- Airton's Solution - View in Browser
- AaronScott2's Solution
- Zaid Khraibut's Solution - View in Browser - (Interactive!)
- Highflyer's solution
- Maria Theodo's solution - View in Browser
- Toba's solution
- Daunenok's solution - View in Browser
- Gabriel Klueh's solution - View in Browser
- DawidChe's solution
- Josh Archer's solution
- gr3if's solution
- Zakir's solution
- Michael Nazari's solution
- Curtis Babin's solution
- Paritosh's solution
- marleybrush's solution
- RamsesGonzalez's solution
- bwkrayb's solution
- Dev Mehta's solution
- Loc Nguyen's solution
- codebreeze's solution - View in browser
- Igor's solution - View In Browser
- Veronika's solution - View in browser
- Tim Ott's solution
- Dallas Rhinehart's solution
- Will Cardoso's solution
- jacobhancock's solution - View in browser
- Bolcik's solution
- Robtak's solution - View in Browser
- Rosita's solution - View in Browser
- Anton Smid's solution for N°1 - View in Browser
- Dylan's solution - View in Browser
- Arunava's Solution
- Sheldon K's Solution - View in Browser
- Mayank Patel's Solution - View in Browser
- Daniel T's Solution - View in Browser
- Brandon B's Solution to Problem 1 / View in Browser
- Alex's solutions to problems 1 & 2
- Joey Robertson's Solution to 1, 2, & 3
- Nevin Herring's Solution - View in Browser
- Rwasa's Solution - View in Browser
- MPalhidai's Solution & Project Euler Repo
- Santiago Rodríguez Solution & Project Euler Repo
- Taras's Solutions (updating) - View in Browser
- cedalukic's Solution - View in Browser
- Nate W's Solution
- Steve Yankson's Solution
- Jason's solution to Project Euler Problem 1 - View in browser
- nboaldin's solution to Project Euler Problem 1 - View in browser
- KaczmarekWill's solution to Project Euler Problems 1-4
- Christene Bennett's Solution
- Jonathan Cheung's Solution for problem 1 and 2
This section contains helpful links to other content. It isn't required, so consider it supplemental for if you need to dive deeper into something:
- A straight-to-the-point primer on JavaScript from discovermeteor.com
- More videos about JavaScript functions from wickedlysmart.com
- Reading: The first several sections of hsablonniere's JavaScript 101 course.
- Interactive: Do the additional sections in the Codecademy JavaScript Track.
- OverAPI's JavaScript cheat sheet