JavaScript Basics Stephen Delaney sdelaney@skokielibrary.info.

Slides:



Advertisements
Similar presentations
JavaScript & jQuery JavaScript and jQuery introduction.
Advertisements

1 Programmer-Defined Functions Functions allow program modularization Variables declared in function are local variables Only known inside function in.
JavaScript Part for Repetition Statement for statement Cpecifies each of the items needed for counter-controlled repetition with a control variable.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic JavaScript: Introduction to Scripting.
Javascript II Expressions and Data Types. 2 JavaScript Review programs executed by the web browser programs embedded in a web page using the script element.
JAVASCRIPT Introduction Kenny Lam. What is Javascript?  Client-side scripting language that can manipulate elements in the DOM  Event-driven language.
1 CS101 Introduction to Computing Lecture 29 Functions & Variable Scope (Web Development Lecture 10)
JavaScript JavaScript is a scripting language that is most commonly used to add client- side programming to a web page. Some of the things it is used for.
PHP TUTORIAL. HISTORY OF PHP  PHP as it's known today is actually the successor to a product named PHP/FI.  Created in 1994 by Rasmus Lerdorf, the very.
CISC474 - JavaScript 03/02/2011. Some Background… Great JavaScript Guides: –
The Web Wizard’s Guide To JavaScript Chapter 6 Working with Dates and Times.
Copyright ©2005  Department of Computer & Information Science Using Number & Math Objects.
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
CHAPTER 4 Java Script อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
Cross Site Integration “mashups” cross site scripting.
20-753: Fundamentals of Web Programming 1 Lecture 12: Javascript I Fundamentals of Web Programming Lecture 12: Introduction to Javascript.
JavaScript Syntax and Semantics. Slide 2 Lecture Overview Core JavaScript Syntax (I will not review every nuance of the language)
Lecture 9: AJAX, Javascript review..  AJAX  Synchronous vs. asynchronous browsing.  Refreshing only “part of a page” from a URL.  Frameworks: Prototype,
CS346 Javascript -3 Module 3 JavaScript Variables.
Chapter 3 Functions, Events, and Control Structures JavaScript, Third Edition.
JSTL The JavaServer Pages Standard Tag Library (JSTL) is a collection of useful JSP tags which encapsulates core functionality common to many JSP applications.
JavaScript, Fourth Edition
AJAX James Kahng. Congrats Jack Guo for Angular entryentry This week’s coding challenge at end of talk.
XP Tutorial 2 New Perspectives on JavaScript, Comprehensive1 Working with Operators and Expressions Creating a New Year’s Day Countdown Clock.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Variables.
AJAX and REST. Slide 2 What is AJAX? It’s an acronym for Asynchronous JavaScript and XML Although requests need not be asynchronous It’s not really a.
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
JavaScript and Ajax (JavaScript Functions) Week 5 Web site:
Expressions and Data Types Professor Robin Burke.
Overview Web Technologies Computing Science Thompson Rivers University.
JavaScript and Ajax Week 10 Web site:
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
ITM 3521 ITM 352 Functions. ITM 3522 Functions  A function is a named block of code (i.e. within {}'s) that performs a specific set of statements  It.
Introduction to JavaScript MIS 3502, Fall 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 9/29/2016.
Web Database Programming Using PHP
Web Programming Anselm Spoerri PhD (MIT) Rutgers University
Web Technologies Computing Science Thompson Rivers University
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
JavaScript Introduction
Chapter 10 Programming Fundamentals with JavaScript
Time to learn to code Stephen Delaney
Web Database Programming Using PHP
AJAX and REST.
CNIT 133 Interactive Web Pags – JavaScript and AJAX
JavaScript Syntax and Semantics
JavaScript Basics Stephen Delaney
14 A Brief Look at JavaScript and jQuery.
JavaScript an introduction.
Chapter 10 Programming Fundamentals with JavaScript
Built in Fairfield County: Front End Developers Meetup
JavaScript Basics Stephen Delaney
WEB PROGRAMMING JavaScript.
PHP.
T. Jumana Abu Shmais – AOU - Riyadh
JavaScript What is JavaScript? What can JavaScript do?
Web DB Programming: PHP
Tutorial 4 JavaScript as OOP Li Xu
Variables Kevin Harville.
CS5220 Advanced Topics in Web Programming Node.js Basics
JavaScript What is JavaScript? What can JavaScript do?
JavaScript CS 4640 Programming Languages for Web Applications
Web Technologies Computing Science Thompson Rivers University
The Web Wizard’s Guide To JavaScript
CS3220 Web and Internet Programming JavaScript Basics
Web Programming and Design
ITM 352 Functions.
Intro to Programming (in JavaScript)
JavaScript CS 4640 Programming Languages for Web Applications
Presentation transcript:

JavaScript Basics Stephen Delaney sdelaney@skokielibrary.info

Review: Creating Reusable Code with Functions Creating functions Returning values from functions Variable scope

Creating a Function When you see parentheses following a name, you know you’re seeing a function No semicolon after the closing brace

Calling a Function The bottom line calls the function

Return Statements Return statements: Pass a value (only one) Exit immediately

Arguments and Parameters The argument is stored in a variable called a parameter person is the parameter "Frank" is the argument

Variable Scope Function scope vs. global scope

Variable Scope Function scope vs. global scope

isNaN()

Throwing Errors

Questions? https://teamtreehouse.com/library/using-sql-and-nodejs-with-sequelize

Review https://teamtreehouse.com/library/using-sql-and-nodejs-with-sequelize

Variables Variables must begin with a letter, $ or _ Variables are case-sensitive var person and var Person are two variables typeof

Strings Properties i.e. string.length Methods i.e. string.toUpperCase()

Concatenation

Types of Numbers Integers 10, -8, 2787382 Floating point numbers 3.14, -10.6454 Scientific notation 5.7e+4 => 57000

Shorthand Operators += -= *= /= x += y is shorthand for x = x + y

Parsing Numbers parseInt() parseInt(10.6) 10 parseFloat() parseFloat(10.6) 10.6

Terms NaN Not a Number DRY Don’t Repeat Yourself

The Math Object Math.round() Math.round(10.6)  11 Math.floor() Math.ceil() Math.ceil(10.6)  11

The Math Object Math.random() Floating number, from 0 (inclusive) to 1 (exclusive)

Comparison Operators Operator Meaning True expressions == Equality 10 == '10' === Strict equality (2 * 5) === 10 != Inequality 9 != 10 !== Strict inequality '10' !== 10 > Greater than 20 > 10 >= Greater than or equal '10' >= 10 < Less than 10 < 30 <= Less than or equal '10'<= 10

And Operator: && Condition 1 Condition 2 Result TRUE FALSE

Or Operator: || Condition 1 Condition 2 Result TRUE FALSE

Not Operator: ! Condition Result TRUE FALSE

If Statements integrated development environment

What’s next?

Next Steps jQuery jQuery is used by 71.8% of all websites. That is a JavaScript library market share of 96.4%. https://w3techs.com/technologies/overview/javascript_library/all

Next Steps AJAX Asynchronous JavaScript And XML Get data without a page refresh https://w3techs.com/technologies/overview/javascript_library/all

Next Steps MEAN stack “In the MEAN stack, we use MongoDB as our database. We write most of our code in Javascript. We rely on Node and Express.js to host our application and serve APIs/Views. We use AngularJS to render our views that are served by Express.”

Next Steps MEAN stack

Navigate to library: Sort by difficulty Select course Select JavaScript https://teamtreehouse.com/library/topic:javascript/type:course/sort:difficulty

Recommended Syllabus JavaScript Loops, Arrays and Objects JavaScript and the DOM jQuery Basics There is also a shorter one called Introduction to jQuery. AJAX Basics

Recommended Syllabus Interactive Web Pages with JavaScript Object-Oriented JavaScript Node.js Basics Build a Simple Dynamic Site with Node.js Express Basics Build a REST API With Express Mongo Basics* Angular Basics* Building a MEAN Application *Indicates a course that is not under JavaScript Application program interface (API) Representational state transfer (REST) Create, read, update, destroy (CRUD) http://softwareengineering.stackexchange.com/questions/120716/difference-between-rest-and-crud

NoSQL vs. SQL

Comparing NoSQL and SQL Are you Google? Do you know what you are building? What framework are you in?

Comparing NoSQL and SQL What is NoSQL? SQL vs. NoSQL The NoSQL Debate: Automatic vs. Manual Transmission When should I use a NoSQL database instead of a relational database? NoSQL Use Case Scenarios or WHEN to use NoSQL

Comparing NoSQL and SQL http://db-engines.com/en/ranking

ORM

ORM Object-relational Mapping Translates between you and SQL Makes life easier! MEAN stack is optimized for MongoDB (Mongoose ORM), but if you would like to use SQL: Sequelize Treehouse: Using SQL and Node.js with Sequelize Bookshelf.js

Thanks!