Skip to content

PRO TIP Block youtube.com at the DNS level — Pi-hole, NextDNS or your hosts file — but allow youtube-nocookie.com and i.ytimg.com. These tutorials keep playing; the rabbit hole does not.

Learning without distractions

Refactoring Code | Rock Paper Scissors | Web Dev | Javascript

10.3K views on YouTube

Web Dev Roadmap for Beginners (Free!): https://bit.ly/DaveGrayWebDevRoadmap

In this video we refactor our Rock, Paper, Scissors code two times. We take our first version and refactor it with a loop and an array. Then, we continue refactoring code by updating the entire application to a functional approach.

▶ This video is part of the JavaScript Tutorials for Beginners Playlist found here: https://www.youtube.com/playlist?list=PL0Zuz27SZ-6Oi6xNtL_fwCrwpuqylMsgT

✅ Quick Concepts outline:
Refactoring Code: Rock, Paper, Scissors
• Comparing version 1 and version 2
• Adding a loop
• Adding an array
• Eliminating the reload
• Testing our code
• Comparing version 2 and version 3
• A functional approach

📺 Here’s the refactored code for each version:

Gist for Rock, Paper, Scissors version 1:
https://gist.github.com/gitdagray/38322a7141f4236e050086e7053febb7

Gist for Rock, Paper, Scissors version 2 (add loop and array):
https://gist.github.com/gitdagray/a709dba6c46fcd2b239a8a5679af4e0e

Gist for Rock, Paper, Scissors version 3 (with functions):
https://gist.github.com/gitdagray/c33ef93ba4c18aa3d123c26be23d539a

📺 More Beginner JS Videos:
freeCodeCamp: https://youtu.be/PkZNo7MFNFg
Traversy Media: https://youtu.be/hdI2bqOjy3c
The Net Ninja: https://youtu.be/iWOYAxlnaww

✅ Follow Me:
Twitter: https://twitter.com/yesdavidgray
Reddit: https://www.reddit.com/user/DaveOnEleven
Medium: https://medium.com/@davegray_86804

#rock #paper #scissors