1-5 Javascript
Last updated
Last updated
-Javascript is a dynamic, object based programming language -Works with your HTML and CSS -Used to make websites interactive and also used in video games
Variables are names that are associated with a value and that value can change.
In JS, you can use variables to hold the values of text/string, numbers, or objects.
A variable is used to store information for later use, similar to storing values for x and y in algebra.
Start by declaring the variable in your JS code like this:
The key to using variables it to give them a meaningful name, so that it is easy to understand in your code.
Rules:
Must begin with a letter
Names are case sensitive (Ex: FirstName does not equal firstName)
No spaces in the name - if using multiple words just put them together
Start with a lowercase letter and capitalize the first letter of any other words used in the name (Ex: firstName, lastName)
Make sure the name is meaningful (Ex: firstName means more than x or y)
Input - gives the user a textbox to type into
Button - used to allow the user to make something happen
functionName() will connect to a function that is in the Javascript.
Functions are blocks of code designed to perform a specific task.
Functions are executed when something calls it (clicking a button, clicking a hyperlink, hovering, etc.)
For example, if you are on Amazon placing an order, when you click Submit your order is processed. Clicking the Submit button would call a function that would process your order (charge your credit card, ship the order, etc.).
1) Use the Codepen we created together as a starting point. If you don’t have that, you can click here.
2) Add or change the following things about your website:
3) Make sure you test your website to make sure it looks and works like you want it to. Double-check that your welcome message displays with good punctuation, spelling, and spacing.
4) You can submit a link to your codepen. Be sure to save your work occasionally!!
Print this document and follow the instructions.