Presentation is loading. Please wait.

Presentation is loading. Please wait.

MTA EXAM 98-375 HTML5 Application Development Fundamentals.

Similar presentations


Presentation on theme: "MTA EXAM 98-375 HTML5 Application Development Fundamentals."— Presentation transcript:

1 MTA EXAM 98-375 HTML5 Application Development Fundamentals

2 98-375: OBJECTIVE 4 Code by Using JavaScript

3 Manage and maintain JavaScript LESSON 4.1

4 In this lesson, you will review the following: Variable naming and techniques to avoid naming collisions within a global scoped environment. Creating and using functions. Using Windows ® Library for JavaScript, jQuery, and other third-party libraries. OVERVIEW Lesson 4.1

5 What is the difference between a global and a local variable? How can you avoid problems if a browser does not support JavaScript? What is the purpose of using Windows Library or jQuery for JavaScript in your website? GUIDING QUESTIONS Lesson 4.1

6 LECTURE Lesson 4.1 Variable Naming and Techniques Avoid naming collisions within a global scoped environment. Global variable names should start with an underscore, cannot contain spaces, and are case sensitive, ie: _globalVariable=6; A variable is declared with the keyword var followed by the variable name. Example: var lastName; This is a local variable; therefore, it starts with a lowercase letter. Variable names cannot be the same as any reserved words, such as var, int, if, else. Give unique names to variables, especially when your program includes methods from outside your code such as jQuery.

7 LECTURE Lesson 4.1 Creating and Using Functions To create a function (a block of code designed to perform a certain action), you must give the function a name. Functions allow more control over when the code is executed. Events can be used to trigger a function to execute. Functions can receive values by enclosing them in the parenthesis, and they can also return values, such as the result of a calculation. To call a function, specify the function name and any required values in parenthesis.

8 LECTURE Lesson 4.1 Using Windows Library for JavaScript, jQuery, and Other Third-Party Libraries JavaScript has several built-in functions. Windows Library, jQuery, and other third-party libraries provide other common objects, functions, and properties that can be used in your JavaScript program. This is also known as an API.

9 DEMONSTRATION Lesson 4.1 Writing a JavaScript Function In this demonstration, you will see how adding JavaScript to a page can make the page dynamic and interactive.

10 DISCUSSION Lesson 4.1 What are the benefits of saving JavaScript in an external file?

11 IN-CLASS ACTIVITY Lesson 4.1 Directions: Read the scenario in the In-class Activity. Create an HTML5 page with JavaScript and test it in a browser.

12 REVIEW Lesson 4.1 Can you answer these? What is the difference between a global and a local variable? How can you avoid problems if a browser does not support JavaScript? What is the purpose of using Windows Library or jQuery for JavaScript in your website?

13 ADDITIONAL RESOURCES Lesson 4.1 MSDN Resources JavaScript Fundamentalshttp://msdn.microsoft.com/en- us/library/6974wx4d(v=VS.94).aspx JavaScript Referencehttp://msdn.microsoft.com/en- us/library/yek4tbz0(v=VS.94).aspx Windows Library for JavaScript Reference http://msdn.microsoft.com/en- us/library/windows/apps/br211669.aspx Other Resources jQuery Documentationhttp://docs.jquery.com/Main_Page W3 Schools JavaScript Tutorial http://www.w3schools.com/js/default.asp


Download ppt "MTA EXAM 98-375 HTML5 Application Development Fundamentals."

Similar presentations


Ads by Google