Presentation is loading. Please wait.

Presentation is loading. Please wait.

JavaScript Basics Stephen Delaney sdelaney@skokielibrary.info.

Similar presentations


Presentation on theme: "JavaScript Basics Stephen Delaney sdelaney@skokielibrary.info."— Presentation transcript:

1 JavaScript Basics Stephen Delaney

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

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

4 Calling a Function The bottom line calls the function

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

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

7 Variable Scope Function scope vs. global scope

8 Variable Scope Function scope vs. global scope

9 isNaN()

10 Throwing Errors

11 Questions?

12 Review

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

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

15 Concatenation

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

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

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

19 Terms NaN Not a Number DRY Don’t Repeat Yourself

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

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

22 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

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

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

25 Not Operator: ! Condition Result TRUE FALSE

26 If Statements integrated development environment

27 What’s next?

28 Next Steps jQuery jQuery is used by 71.8% of all websites. That is a JavaScript library market share of 96.4%.

29 Next Steps AJAX Asynchronous JavaScript And XML
Get data without a page refresh

30 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.”

31 Next Steps MEAN stack

32 Navigate to library: Sort by difficulty Select course
Select JavaScript

33 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

34 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)

35 NoSQL vs. SQL

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

37 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

38 Comparing NoSQL and SQL

39 ORM

40 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

41 Thanks!


Download ppt "JavaScript Basics Stephen Delaney sdelaney@skokielibrary.info."

Similar presentations


Ads by Google