Frontend Development: JavaScript
🚀 ReDI Fall 2020 🚀
Lecture
Practice: The new beginning
Let's see what we've got :)
Which one(s) of those are good names for variable?
- var myVariable;
- var age;
- var colorOfTheLeftDoorOnBMW;
Which one(s) is a number in JS?
- var age = 23;
- var postIndex = '123';
- var weight = 75.43;
Which one() is a string in JS?
- var name = "Vasja";
- var surname = 'Pupkin';
- var address = `address is unknown`;
- var city = munich;
What would be the outcome of following code?
var name = 'jack';
console.log(name[1]);
How to find last element in following array?
var strangeNumbers = [1, 4, 7, 12, 99, 0, 12, -1, 4];
Ok, let's practice now :)
Let's build something similar to that:
Specification:
- Create a button element on a page
- Can react on click event
- Change background on mouseover event
- Resctore initial background on mouseleave event
TIPS:
- event names: mouseover, mouseleave, onclick
- to add class to an element: el.classList.add('classname')
- to remove class from an element: el.classList.remove('classname')
Homework
-
Continue FCC section from "Shopping List" till "Golf Code"
- Create issues according to your wireframes and create 1-2 PRs with page layout