\nExternal:\n\n\nWhere? Usually right above
\nslide18. Basic Instructions Variables\n\nData Types\nNumeric: integer or floating-point\nString: \"hello\" or 'hello'\nBoolean: true false\nArrays: [5, true, “weird“]\nCan also be created with constructor: new Array()\nAccess by indexing (zero-based) or calling .item(i)\nLike Java, has length attribute\nExpressions: Like Java...
" }

Introduction to JavaScript COMP 3700 With thanks

Published  . 0 views
↓ Download
Introduction to JavaScript COMP 3700 With thanks
1 / 1
Introduction to JavaScript COMP 3700 With thanks - slide 1 of 18 Introduction to JavaScript COMP 3700 With thanks - slide 2 of 18 Introduction to JavaScript COMP 3700 With thanks - slide 3 of 18 Introduction to JavaScript COMP 3700 With thanks - slide 4 of 18 Introduction to JavaScript COMP 3700 With thanks - slide 5 of 18 Introduction to JavaScript COMP 3700 With thanks - slide 6 of 18 Introduction to JavaScript COMP 3700 With thanks - slide 7 of 18 Introduction to JavaScript COMP 3700 With thanks - slide 8 of 18 Introduction to JavaScript COMP 3700 With thanks - slide 9 of 18 Introduction to JavaScript COMP 3700 With thanks - slide 10 of 18 Introduction to JavaScript COMP 3700 With thanks - slide 11 of 18 Introduction to JavaScript COMP 3700 With thanks - slide 12 of 18 Introduction to JavaScript COMP 3700 With thanks - slide 13 of 18 Introduction to JavaScript COMP 3700 With thanks - slide 14 of 18 Introduction to JavaScript COMP 3700 With thanks - slide 15 of 18 Introduction to JavaScript COMP 3700 With thanks - slide 16 of 18 Introduction to JavaScript COMP 3700 With thanks - slide 17 of 18 Introduction to JavaScript COMP 3700 With thanks - slide 18 of 18
Description: Introduction to JavaScript COMP 3700 With thanks to Rob McMahon, Fang Tang, and Jon Duckett History 1994: Netscape Communications creates Netscape Navigator browser, most popular browser of the 90s Biggest weakness of early web was static

Related Topics

Download Presentation

"Introduction to JavaScript COMP 3700 With thanks" is the property of its rightful owner. Permission is granted to download and print the materials on this website for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.

Presentation Transcript

slide1. Introduction to JavaScript COMP 3700

With thanks to Rob McMahon, Fang Tang, and Jon Duckett<br>
slide2. History 1994: Netscape Communications creates Netscape Navigator browser, most popular browser of the 90s
Biggest weakness of early web was static pages
1995: Netscape directs Brendan Eich to develop a scripting language for dynamic content
Initially called Mocha
Then renamed LiveScript
Then renamed JavaScript
1996: Microsoft acts like Microsoft and releases JScript
1997: JavaScript submitted to ECMA for standardization
ECMAScript (but everyone still calls it JavaScript)<br>
slide4. JavaScript Interpreted, weakly & dynamic typed, multiparadigm
Surface similarities to Java, but many differences
Supported by all web browsers with JS interpreters
Many frameworks extend the capabilities of vanilla JS

Object-Oriented, sort of…
Classes aren’t normally used to contain objects, functions are
Prototypal Inheritance – a hidden property for all objects
A constructor makes an object linked to its own prototype.
Properties are linked, not copied when using class inheritance / objects<br>
slide5. Prototypal Inheritance<br>
slide6. Functional Paradigm JavaScript supports functional programming
Higher-order functions
Functions that take another function as an argument
Functions that return a function
Yield cleaner, more concise code, with less chance of errors
Extensible: user defined HOFs
Common array functions
map(), filter(), every()
Fetching API’s
Supports asynchronous requests<br>
slide7. Functional: every() vs.<br>
slide8. Functional: map()<br>
slide9. Functional: map()<br>
slide10. Other Features JS contains event functions that allow interaction with HTML5 elements easy
onclick(), onload(), etc., ...
Equality is different from Java
=== checks for type and value equality
== checks for value equality after attempting type coercion
Many people came to hate JS in early days
Developed in just 10 days, not intended to become major development platform
Interacting directly with HTML elements in JS is awkward
ES6 & HTML5 introduced stable standards that resolved much of the concerns<br>
slide11. What can JavaScript Do for the Web? JavaScript provides HTML authors a programming tool:
simple syntax
JavaScript can put dynamic text into an HTML page
JavaScript can react to events
JavaScript can read and write HTML elements
JavaScript can be used to validate data
JavaScript can be used to detect the visitor’s browser
JavaScript can be used to create cookies
Store and retrieve information on the visitor’s computer<br>
slide12. JavaScript One of the three primary pillars of web development

HTML – Content & Structure
CSS – Design
JavaScript – Behavior<br>
slide13. HTML, CSS, JavaScript Together<br>
slide14. Object Oriented Modeling As experienced OO developers you know that objects have the following components:
Identity (Reference Handle)
State (Attributes)
Behaviors (Methods)
In JavaScript we also add:
Events (triggers that cause methods to be invoked)<br>
slide15. Web Browser Objects Window Object
Location Attribute: URL of current page
Document Object
Models the content of the web page loaded in the window
A large number of attributes, events, & methods are defined in the DOM (next week)<br>
slide16. Document Object Model Represents your webpage
Properties
width, height, color, font-size, etc.
Events
onClick, onMouseOver, onLoad, etc.
Methods
loadContent(); sayHi(); login(); purchase();<br>
slide17. Loading JavaScript Internal:
<script type="text/javascript">
alert("Hello World");
document.write("Hello World!")
</script>
External:
<script src="js/demo.js“ type="text/javascript"></script>

Where? Usually right above </body><br>
slide18. Basic Instructions Variables

Data Types
Numeric: integer or floating-point
String: "hello" or 'hello'
Boolean: true false
Arrays: [5, true, “weird“]
Can also be created with constructor: new Array()
Access by indexing (zero-based) or calling .item(i)
Like Java, has length attribute
Expressions: Like Java...<br>