COP 3813 Intro to Internet Computing

COP 3813 Intro To Internet Computing-ppt Download

  • Date:27 Jul 2020
  • Views:16
  • Downloads:0
  • Size:125.50 KB

Share Presentation : COP 3813 Intro To Internet Computing

Download and Preview : COP 3813 Intro To Internet Computing

Report CopyRight/DMCA Form For : COP 3813 Intro To Internet Computing


Transcription:

Intro to InternetProf Roy LevowJavaScript JavaScript JavaScript.
Object oriented programming language Interpreted from source code Supported by most browsers Executed on client system in browser Program text output is treated as html.
and rendered by browser Includes extensive support forgenerating web page and window Variables and Assignment Variable names essentially as in C .
No type in declarationvar name1 name2 Assignment operator Expressions Very similar to C .
Arithmetic Operators etc as in C Comparison operators String concatenation with also converts other values to string if possible.
Output withdocument writeln str Input withval window prompt msg Basic Control Structures.
if cond else optional else part block while cond for init test incr stmt.
Use on Web Page Generates code where script isexecuted in body Functions can go in head Wrap with.
script type text javascript code goes here Examples Class Average 2 fig 8 9 Analysis fig 8 11 .
Interest Table fig 9 6 More Control Statements switch choice case val stmtdefault optional.
do stmt while cond Examples Bullet lists with switch fig 9 7 Headings with do while fig 9 9 Logical Values and Operators.
Logical Values aretrue false Usual logical operatorsShort circuit evaluation Defining Functions.
function fname parm1 parm2 return expr No return type expr in return omitted if no return value Table of Random Numbers.
fig 10 4 Note use of functions from class Math DieRoll fig 10 5 Craps fig 10 6 Array is a class.
Declare array withvar list new Array size Access with list index Start with 0 Can hold any type of value.
Deallocation is automatic when anothervalue is assigned to variable list length returns length Arrays Initialization In constructor.
new Array red green blue By array objectx 1 2 3 4 Can have undefined values never Example DieRoll fig 11 6.
Reference Parameters Arrays and objects are passed byreference so a change in the functionchanges the calling value Scalars are passed by value.
Two dimensional Arrays Declare an Array for rows Then assign an Array to each Does not enforce rectangular form Access with Array i j .
Similarto C Declared with new Math object has elements that arestandard math functionsMath sin x .
Class String supports character Constants are surrounded by Can use usual C escaped Has many methods for stringmanipulation.
Operator for concatenation Example SplitAndSubString html fig Date Object Access and format date and time See definitions at W3Schools.
Example DateTime html fig 12 9 Document and Window Objects Document object allows access to allcomponents of a document See definitions at W3Schools.
Window object allows control ofwindow features See definitions at W3Schools Example Window html fig 12 13 Accessed through Document cookie.
Example cookie html fig 12 15 Final Example final html fig 12 16COP 3813 Intro to Internet Computing Prof. Roy Levow Lecture 4 JavaScript

Related Presentations