Variables Kevin Harville.

Slides:



Advertisements
Similar presentations
JavaScript I. JavaScript is an object oriented programming language used to add interactivity to web pages. Different from Java, even though bears some.
Advertisements

Objective: Dealing with data in C++ Agenda: Notes Essay Help.
Lesson 4: Formatting Input Data for Arithmetic
JavaScript, Third Edition
National Diploma Unit 4 Introduction to Software Development Data types, variables and constants.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
CPS120: Introduction to Computer Science
DHTML AND JAVASCRIPT Genetic Computer School LESSON 5 INTRODUCTION JAVASCRIPT G H E F.
Primitive Variables.
CS346 Javascript -3 Module 3 JavaScript Variables.
ECA 225 Applied Interactive Programming1 ECA 225 Applied Online Programming basics.
VARIABLES AND DATA TYPES Chapter2:part1 1. Objectives: By the end of this section you should: Understand what the variables are and why they are used.
Variables and Data Types Data (information we're going to store) – Numbers – Text – Dates What types of data can JavaScript process? How do we store it?
05 – Java Script (1) Informatics Department Parahyangan Catholic University.
ITEC 109 Lecture 7 Operations. Review Variables / Methods Functions Assignments –Purpose? –What provides the data? –What stores the data? –What type of.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Variables.
Part:2.  Keywords are words with special meaning in JavaScript  Keyword var ◦ Used to declare the names of variables ◦ A variable is a location in the.
Values, Types, and Variables. Values Data Information Numbers Text Pretty much anything.
 Variables can store data of different types, and different data types can do different things.  PHP supports the following data types:  String  Integer.
 Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. 
DATA TYPES, VARIABLES AND CONSTANTS. LEARNING OBJECTIVES  Be able to identify and explain the difference between data and information  Be able to identify,
JavaScript and Ajax (JavaScript Data Types) Week 2 Web site:
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
Modern JavaScript Develop And Design Instructor’s Notes Chapter 4 – Simple Variable Types Modern JavaScript Design And Develop Copyright © 2012 by Larry.
Checking If User Input Is Numeric.  Quiz  Detecting numeric input  Finish Prior Lecture  Y'all work on one of the problems listed 2.
Slide 1 Chapter 3 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration statement. For example: Dim.
JavaScript Variables. Definition A variable is a "container" for information you want to store. A variable's value can change during the script.
Programming for the Web JavaScript Basics Dónal Mulligan BSc MA
Input, Output and Variables GCSE Computer Science – Python.
Chapter 2 Variables and Constants. Objectives Explain the different integer variable types used in C++. Declare, name, and initialize variables. Use character.
Fundamentals 2.
PHP using MySQL Database for Web Development (part II)
Unit 2 Technology Systems
CST 1101 Problem Solving Using Computers
A variable is a name for a value stored in memory.
CIS3931 – Intro to JAVA Lecture Note Set 2 17-May-05.
Chapter 6 JavaScript: Introduction to Scripting
User Interaction and Variables
Variables Variables are used to store data or information.
Visual Basic Variables
Introduction to Python Data Types and Variables
Revision Lecture
Variables, Expressions, and IO
Scope, Objects, Strings, Numbers
JavaScript Syntax and Semantics
Web Programming– UFCFB Lecture 19-20
PHP Variables A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume) Rules for PHP variables: A variable.
JavaScript.
Variables In programming, we often need to have places to store data. These receptacles are called variables. They are called that because they can change.
البرمجة بلغة فيجول بيسك ستوديو
WEB PROGRAMMING JavaScript.
Numbers.
PHP.
T. Jumana Abu Shmais – AOU - Riyadh
C++ Data Types Data Type
Chapter 2: Java Fundamentals
The Internet 11/15/11 Handling Data in JavaScript
We are starting JavaScript. Here are a set of examples
Chapter 2: Java Fundamentals
Variables In today’s lesson we will look at: what a variable is
JavaScript.
Tutorial 10: Programming with javascript
JavaScript: Introduction to Scripting
Variables Here we go.
Unit 3: Variables in Java
Data Types Every variable has a given data type. The most common data types are: String - Text made up of numbers, letters and characters. Integer - Whole.
Data Types and Maths Programming Guides.
Values and Variables.
Variables and Constants
SEEM 4540 Tutorial 4 Basic PHP based on w3Schools
Presentation transcript:

Variables Kevin Harville

Variables Variables are a named space in the computer where a value is stored. Examples User’s age User’s name Any characters or numbers you need use in which the values may vary.

Variable Names Names are CASE SENSITIVE Var totalStudents is not TotalStudents Use letters or underscore. Can use numbers after the first character var Student_Name; var Score7; Be descriptive. Use no punctuation or spaces. var NumberOfFishInGrandmasAquarium;

Variable Scope The “scope” of a variable is the range within the program where it can be used. If a variable is declared within a function, the scope of the variable is local, meaning limited to that function. Other variables are global to the entire script.

Data Types Variables in JavaScript are variant. That means that they are usually not specified as being a particular type of data, such as characters, a decimal number, or a number. However, we can specify our data as being of a particular type if needed.

Data Types Numbers Boolean ( true / false ) Strings (characters) Null values (JavaScript keyword null)

Converting Strings to Numbers Any input from the user may be considered by the computer to be strings of characters. “10” + “40” = “1040” Therefore we tell the computer to consider the text to be integer or floating point (decimal numbers). age = parseInt(age); myFraction = parseFloat(myInput);

Just Remember… If your input should be an integer convert it using parseInt(). If your input should be a decimal convert it using parseFloat(). If your response is NaN, then the computer can’t convert it to a number