Class 6 Notes for Web Scripting 

Learning Objectives:

You will be able to identify the different Math methods

You will be able to create a lottery number picker.

You will be able to identify what is on the Quiz

 

Homework:

Read: Chapter 6 & 9

Create: Find and Disect a javascript your find on the web and Post to Canvas!

Review: Math, Objects & Arrays on W3schools

 

Topics Covered:

The Quiz is open book, Web and notes just not open neighbor!

Know the basic terms like Variable, Array, Function and Objects

I will give you a file and expect you to fix all the syntax errors associated with JavaScript.

I will give you a JavaScript project (similar to one we created in project) that you will need create from scratch.

 


Arrays (a family of variables)
array_name = new Array() myfun = new Array()
Variables in the array: myfun [0] = first variable, myfun [1] = second variable, ...
join() concat() sort()
Confirmation
confirm("Text_for_pop_up ") confirm("Click to Continue ")
True continues with process
False process stops
Pop-up Window
window.open("URL", "target","features","") window.open("http://www.asu.edu","_blank", "width=400, height=400")
Features include dimensions of the window and tool bars
Objects
JavaScript has several built-in objects, like StringDate, and Array plus you can create your own objects.
objName=new Object() mycar=new Object()
Objects have Properties (objName.propName)and Methods (objName.methodName())

Math Medthods()

round(): Rounding number

random(): Returns a random number between 0 and 1.

max(): to return the number with the highest value of two specified numbers.

min(): to return the number with the lowest value of two specified numbers.

ceil(x): Returns x, rounded upwards to the nearest integer.

PI: Returns the value of PI (approx. 3.14)

Terms:

arrays, variables, objects (arrays,date,math)

Properties are the values associated with an object.

Methods are the actions (functions) that can be performed on objects

 

 

HTML Valid