JavaScript Basics Stephen Delaney sdelaney@skokielibrary.info.

Slides:



Advertisements
Similar presentations
1 Programmer-Defined Functions Functions allow program modularization Variables declared in function are local variables Only known inside function in.
Advertisements

Lesson 4: Formatting Input Data for Arithmetic
1 COMP 110 Static Methods and Variables Tabitha Peck M.S. March 24, 2008 MWF 3-3:50 pm Philips 367.
JAVASCRIPT TIPS. REMEMBER JAVASCRIPT IS VERY, VERY CASE SENSITIVE.
1 JavaScript/Jscript 4 Functions. 2 Introduction Programs that solve real-world programs –More complex than programs from previous chapters Best way to.
Computers and Scientific Thinking David Reed, Creighton University Functions and Randomness 1.
Advanced Decisions and Loops Chapter Some Simple Schoolroom Statistics.
Working with Numbers parseInt() and parseFloat() Math.round() Other Math object functions isNaN() toFixed()
Using Object-Oriented JavaScript CST 200- JavaScript 4 –
(CS1301) Introduction to Computer Programming City Univ of HK / Dept of CS / Helena Wong 6. Functions and Objects I - 1
The Web Wizard’s Guide To JavaScript Chapter 6 Working with Dates and Times.
Chapter 6: More JavaScript CIS 275—Web Application Development for Business I.
Copyright ©2005  Department of Computer & Information Science Using Number & Math Objects.
Javascript. Javascript Tools Javascript Console Javascript Console Debugger Debugger DOM Inspector DOM Inspector.
CHAPTER 4 Java Script อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
Pemrograman Teknologi Internet W06: Functions and Events.
The Grammar of JavaScript.  Each line of a script is a statement  An instruction that JavaScript can evaluate (make sense of)  Ends with a semicolon;
Math With Java The Math Class. First, A Quick Review of Math Operators in Java Primitive Data type in Java that represent numbers: Primitive Data type.
Math Class Part of the Java.lang package. This package is from object so you do not have to import the lang package. Static: Math Class is static.
Numbers © Copyright 2014, Fred McClurg All Rights Reserved.
CS346 Javascript -3 Module 3 JavaScript Variables.
Basic Data Types Numbers (integer and floating point)‏ Strings (sequences of characters)‏ Boolean values (true/false)‏
2 pt 3 pt 4 pt 5pt 1 pt 2 pt 3 pt 4 pt 5 pt 1 pt 2pt 3 pt 4pt 5 pt 1pt 2pt 3 pt 4 pt 5 pt 1 pt 2 pt 3 pt 4pt 5 pt 1pt Scientific Notation Multiplication.
JavaScript Assignment Statements Expressions Global Functions CST 200 JavaScript.
XP Tutorial 2 New Perspectives on JavaScript, Comprehensive1 Working with Operators and Expressions Creating a New Year’s Day Countdown Clock.
Scientific Notation Practice Problems #3.
Math Class Mrs. C. Furman September 2, Math frequently used methods NameUse floor()rounds down ceil()rounds up pow(x,y)returns x to the power of.
Hazırlayan:Emin BORANDAĞ 2/17/ Numerik Değerler Kullanımı Integers are considered accurate up to 15 digits. Try it function myFunction() { var x.
JavaScript and Ajax (JavaScript Data Types) Week 2 Web site:
Chapter 9: Control Statements II CIS 275—Web Application Development for Business I.
CIS 228 The Internet 11/17/11 Of Timers and Cookies.
JavaScript and Ajax (JavaScript Functions) Week 5 Web site:
Expressions and Data Types Professor Robin Burke.
Change to scientific notation: A. B. C. 289,800, x x x
JavaScript- conditions, Math objects. Generic Representation.
Checking If User Input Is Numeric.  Quiz  Detecting numeric input  Finish Prior Lecture  Y'all work on one of the problems listed 2.
Chapter 4 Mathematical Functions, Characters, and Strings 1.
8 th Grade Math Unit 2 Review. Unit 2 Review 1) Identify the base and exponent of the following number: 3 5.
CSCI/CMPE 4341 Topic: Programming in Python Chapter 5: Functions – Exercises Xiang Lian The University of Texas – Pan American Edinburg, TX 78539
JavaScript Basics Stephen Delaney
Chapter 4 Mathematical Functions, Characters, and Strings
Math class Random() method Floor method Top-level parseInt function
Lecture 6: While Loops and the Math Class
Predefined Functions Using the JavaScript Documentation
Chapter 4 Mathematical Functions, Characters, and Strings
Basics of JavaScript Programming Language
SEEM4570 Tutorial 05: JavaScript as OOP
14 A Brief Look at JavaScript and jQuery.
Chapter 3 Methods.
Chapter 10 - JavaScript: Functions
Working with Text and Numbers in Java
Variables and Data Types
“Step functions” are sometimes used to describe real-life situations.
Choose the best answer for each problem.
Tutorial 4 JavaScript as OOP Li Xu
The Internet 11/15/11 Handling Data in JavaScript
Chemistry Chapter 2 Scientific Notation!.
Variables Kevin Harville.
We are starting JavaScript. Here are a set of examples
Random number generators
4105 CHALLENGING REVIEW QUIZ
Using Built In Objects Kevin Harville.
Computer Science 2 More Trees.
Using java libraries CGS3416 spring 2019.
Millennium High School Agenda Calendar
Dry Run Fix it Write a program
MATH TALK POWER NUMBER 27.
Murach's JavaScript and jQuery (3rd Ed.)
Murach's JavaScript and jQuery (3rd Ed.)
Working with Numbers parseInt() and parseFloat() Math.round()
Presentation transcript:

JavaScript Basics Stephen Delaney sdelaney@skokielibrary.info

Review: Working With Numbers Doing math in JavaScript The random challenge

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

Is this a number? var greatNumber = ‘10’ *Introducing typeOf()

What are these for? += -= *= /= var score = 10 score += 7 17

What’s the difference between? parseInt() parseInt(10.6) 10 parseFloat() parseFloat(10.6) 10.6

What do these mean? NaN Not a Number DRY Don’t Repeat Yourself

What do these do? Math.round() Math.round(10.6)  11 Math.floor() Math.ceil() Math.ceil(10.6)  11

What does this do? Math.random() Floating number, from 0 (inclusive) to 1 (exclusive)

Challenge: Write the code to generate a random number between 1 and 10. Math.floor(Math.random() * 10) + 1

Questions?