• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Lesson 08
 

Lesson 08

on

  • 294 views

 

Statistics

Views

Total Views
294
Views on SlideShare
294
Embed Views
0

Actions

Likes
0
Downloads
2
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Lesson 08 Lesson 08 Presentation Transcript

    • Front-End Web Development Lesson 8 Functions
    • Agenda ● ● ● ● ● Review Pizza Project JavaScript Functions Parameters and arguments The return keyword Lab
    • Functions A function is a series of programming steps that you set up at the beginning of your script ● ● ● write code once run code any time you like run code as many times as you like
    • Functions Basic structure: function functionName() { // the JavaScript you want to run }
    • Functions Naming functions (examples): ● calculateTax() ● getScreenHeight() ● updatePage() ● fadeImage() Cannot use JavaScript reserved words
    • Code Along Need template.html and two css files. Save template.html as print_date.html Two steps: ● create function in head ● call function in body
    • Built-In Functions JavaScript Built-in Functions String Methods toLowerCase() Date Methods toDateString()
    • Parameters & Arguments Parameters are variables used to accept information into a function. Arguments are values used to supply information to a function.
    • Parameters & Arguments Example: function print(message) { document.write(message); } parameter argument print(‘Example of parameters and arguments’);
    • Code Along parameters.html
    • Retrieving Info from Functions To return a value from your own functions, use the return keyword. Notes: ● the return keyword should be the last statement in a function ● a function can only return one value
    • Retrieving Info from Functions Example: function functionName(parameter1, parameter2) { // the JavaScript you want to run return value; }
    • Code Along tax.html quiz.html
    • Lab Create a quiz (at least five questions) testing the user’s knowledge on the HTML, CSS and JavaScript you’ve learned so far. ● make functional first ● make stylish last ● upload to server ● ask classmates to take the quiz
    • Lab Build out pizza site: ● add date ● add sales tax function Create index page for your server