Presentation is loading. Please wait.

Presentation is loading. Please wait.

Web Systems Development (CSC-215)

Similar presentations


Presentation on theme: "Web Systems Development (CSC-215)"— Presentation transcript:

1 Web Systems Development (CSC-215)
Lecture 16: JavaScript – Functions, Objects, Arrays

2 WSD Makeup Class Friday 27th April 2:00-3:30pm

3 Javascript also based on objects as already seen with the dom

4 Defining a Function

5 Arguments Array Why would you need one?

6 Arguments Array More concise scripts

7 Returning values: Cleaning up a full name

8 Returning an Array

9 Example Usage

10 Javascript objects

11 User Class

12 Create a new instance

13 Create empty object and populate

14 Add property

15 Accessing Objects

16 Alternate Syntax

17 Syntax Variations

18 arrays

19 Numeric Arrays

20 Numeric Arrays - Shorthand

21 PHP Array Element Assignment

22 JavaScript Array Element Assignment

23 JavaScript Array Element Assignment
Alternative

24 Get Array Length

25 Create, Build & Print Array

26 Assignment using Array Keyword
More elements can be added later on

27 Associative Array

28 Multidimensional Arrays

29 Array functions

30 concat Banana, Grape, Carrot, Cabbage

31 concat

32 join Join array elements to create one string

33 Push and pop

34 reverse

35 sort

36 For further details, use MDN
For further details, use MDN

37 Practice Exercise Create and demo a JavaScript class named Book
Properties Title Author Price Method Getters Setters Update price Use prompt to instantiate two objects as per values entered by the user Print the two Use prompt to ask the user to update the prices Print the two updated objects

38 Lecture content adapted from chapter 16 of Learning PHP, MySQL, JavaScript, CSS & HTML5.


Download ppt "Web Systems Development (CSC-215)"

Similar presentations


Ads by Google