+ All Categories
Home > Documents > Presentation Regarding Front End Web Development in Powerpoint

Presentation Regarding Front End Web Development in Powerpoint

Date post: 18-May-2017
Category:
Upload: benackerman
View: 212 times
Download: 0 times
Share this document with a friend
47
Lesson IX: Front-end Development HTML, Introduction to JavaScript, OOP in JavaScript, XML and JavaScript, AJAX as a Concept
Transcript
Page 1: Presentation Regarding Front End Web Development in Powerpoint

Lesson IX: Front-end Development

HTML, Introduction to JavaScript, OOP in JavaScript, XML and

JavaScript, AJAX as a Concept

Page 2: Presentation Regarding Front End Web Development in Powerpoint

What is JavaScript?• JavaScript adds animation, interactivity and visual effects to your

HTML.

• JavaScript makes immediate feedback possible! This allows for JavaScript powered pages to instantly return results as forms are submitted. The same thing goes with error messages, they can easily be given just before the form is submitted.

• JavaScript also allows for interactive interfaces! You can turn thumbnails into slideshows, organize content into panels for visitors to easily click, create pop up tool tips that give users supplemental information.

Page 3: Presentation Regarding Front End Web Development in Powerpoint

What is JavaScript?

• One of the key selling points of JavaScript is immediacy. It allows for instant response when actions like clicking, filling out forms and moving mouse happen.

• JavaScript never suffers from server-side delay from programming languages like PHP because it doesn’t rely on browser-server communication.

Page 4: Presentation Regarding Front End Web Development in Powerpoint

What is jQuery?

• Writing JavaScript is hard even though its simpler than most programming languages. Writing JavaScript code is hard because different browsers understand JavaScript differently so sometimes applications written on Google Chrome don’t work on Internet Explorer 9.

• This bug eats up a lot of development time as developers try to make sure that their application works for the whole audience.

Page 5: Presentation Regarding Front End Web Development in Powerpoint

What is jQuery?

• jQuery is a JS library that makes programming more easier and more fun. jQuery solves cross browser testing, and other difficult tasks.

• jQuery allows designers to easily create interfaces that JavaScript would otherwise take nearly forever to create. It allows you to easily use plugins to add new features.

Page 6: Presentation Regarding Front End Web Development in Powerpoint

Adding JavaScript to a PageThe <script> tag indicates the format and the content that follows the tag.

Page 7: Presentation Regarding Front End Web Development in Powerpoint

Adding External JavaScriptAdding external JS files allows you to create scripts that can be shared on multiple parts of your site.

Page 8: Presentation Regarding Front End Web Development in Powerpoint

Using the alert() functionUsing the alert() function allows you to create a pop up prompt that contains the string that you entered into it.

Page 9: Presentation Regarding Front End Web Development in Powerpoint

Using the document.write() functionThe document.write() function allows us to instantly write a

Page 10: Presentation Regarding Front End Web Development in Powerpoint

Statements

• A JS statement is the basic programming unit in the script. All lines of a script is a statement.

Example:alert('Hello World!');

• The delimeter used by JS is a semi-colon (;).

Page 11: Presentation Regarding Front End Web Development in Powerpoint

Data Types

• There are three basic data types in JavaScript:– number– string– Boolean

Page 12: Presentation Regarding Front End Web Development in Powerpoint

Numbers

• Numbers is the equivalent of the Number class in Java.

• This allows you to easily manipulate data in any format, as in doubles, integers and bytes.

• Aside from numbers, JS also supports operators to manipulate these data sets.

Page 13: Presentation Regarding Front End Web Development in Powerpoint

Strings

• Unlike Strings in Java JavaScript Strings can also be enclosed in single quotes. Either way, Strings in JavaScript are still the same as they are a sequence of letters.

• Make sure of course that you use the corresponding closing mark when enclosing a String.

• Remember to place appropriate escape characters as well when placing quotes.

Page 14: Presentation Regarding Front End Web Development in Powerpoint

Booleans

• Much like other Boolean values in Java it can only be true or false.

Page 15: Presentation Regarding Front End Web Development in Powerpoint

Variables

• To create a variable type in JavaScript, we write:

– var score;

• Since JavaScript is dynamically typed, this variable can handle any data type.

• The same naming conventions that apply to Java identifiers apply to JavaScript variables.

Page 16: Presentation Regarding Front End Web Development in Powerpoint

Operators

Page 17: Presentation Regarding Front End Web Development in Powerpoint

Notes

• Take note that the same evaluation rules apply as with Java operators.

• That is:– 4 + 5 * 10 is still evaluated as 54

• To allow lower ordered operators to be evaluated first, use parentheses for grouping.

Page 18: Presentation Regarding Front End Web Development in Powerpoint

Adding StringsSimilar to Java, we can concatenate strings using the + operator.

Page 19: Presentation Regarding Front End Web Development in Powerpoint

Adding Numbers and StringsYou can also opt to add both Numbers and Strings together.

Page 20: Presentation Regarding Front End Web Development in Powerpoint

Converting a String to a NumberYou can use the Number() function to convert a String to a number.

Page 21: Presentation Regarding Front End Web Development in Powerpoint

Equivalence Operators

Page 22: Presentation Regarding Front End Web Development in Powerpoint

Prompting for InputThe code above prompts the user for input.

Page 23: Presentation Regarding Front End Web Development in Powerpoint

ArraysThe code above creates an array in JS. Take note that it uses square brackets and not curly brackets.

Page 24: Presentation Regarding Front End Web Development in Powerpoint

ArraysSince JS is dynamically typed, an array can have different kinds of data

Page 25: Presentation Regarding Front End Web Development in Powerpoint

Accessing ArraysJS is implements 0 indexing so accessing an element is always its placement in the array minus 1.

Page 26: Presentation Regarding Front End Web Development in Powerpoint

Length of an Array

Page 27: Presentation Regarding Front End Web Development in Powerpoint

Adding to the ArrayAs we can see the array in JS functions like a stack.

Page 28: Presentation Regarding Front End Web Development in Powerpoint

Adding to an ArrayYou can add more than one value to an array.

Page 29: Presentation Regarding Front End Web Development in Powerpoint

Adding to the start of an ArrayTo place elements to the start of an array, simply use the unshift method.

Page 30: Presentation Regarding Front End Web Development in Powerpoint

Conditional StatementsThe code above shows the syntax for an if statement in JS.

Page 31: Presentation Regarding Front End Web Development in Powerpoint

Comparison Operators

Page 32: Presentation Regarding Front End Web Development in Powerpoint

Comparison Operators

Page 33: Presentation Regarding Front End Web Development in Powerpoint

Conditional StatementThe line of code from above shows how if-else statements in JS are done.

Page 34: Presentation Regarding Front End Web Development in Powerpoint

Conditional StatementThe lines of code above show how if-else-elseif statements are made in JS.

Page 35: Presentation Regarding Front End Web Development in Powerpoint

for-loop statementThe following lines of code show how a for-loop statement is made in JS.

Page 36: Presentation Regarding Front End Web Development in Powerpoint

Looping StatementsThe following lines of codes show how a do-while loop is done in JS.

Page 37: Presentation Regarding Front End Web Development in Powerpoint

FunctionsThe line of code

Page 38: Presentation Regarding Front End Web Development in Powerpoint

FunctionsThe following lines of code show us how to return a value after creating a function in JS.

Page 39: Presentation Regarding Front End Web Development in Powerpoint

JavaScript OOP

• JavaScript allows for robust object-oriented programming, by using the function syntax to create objects.

• Similar to Java, the only way to construct a new object is to invoke the new keyword.

Page 40: Presentation Regarding Front End Web Development in Powerpoint

JavaScript OOP

Page 41: Presentation Regarding Front End Web Development in Powerpoint

JavaScript OOP

• Another way to add functions to JavaScript objects after they have been defined is to use the prototype method.

• Think of this as some kind of inheritance where the new function is added after the object has already been defined.

Page 42: Presentation Regarding Front End Web Development in Powerpoint

JavaScript OOP

Page 43: Presentation Regarding Front End Web Development in Powerpoint

Object Oriented Java-Script

• The prototype keyword is also useful for prebuilt JS objects.

• The recurring rule is that you can use prototype on any object that can be initialized with the word new.

Page 44: Presentation Regarding Front End Web Development in Powerpoint

JavaScript OOP

Page 45: Presentation Regarding Front End Web Development in Powerpoint

Inheritance and Polymorphism

• Just like Java, you get to take advantage of OOP concepts like inheritance and polymorphism.

• The following lines of code show you how to simulate inheritance and polymorphism in JS.

Page 46: Presentation Regarding Front End Web Development in Powerpoint

Inheritance and Polymorphism

Page 47: Presentation Regarding Front End Web Development in Powerpoint

Sources

• JavaScript and jQuery – The Missing Manual 2nd edition, David Sawyer McFarland

• http://www.javascriptkit.com/javatutors/oopjs2.shtml


Recommended