Web Design II Flat Rock Community Schools

Slides:



Advertisements
Similar presentations
Introducing JavaScript
Advertisements

Procedures and Functions. What are they? They are both blocks of code that can be reused to perform specific task. However there is a difference: Function-
Do I need a robot today? You only need a robot if your team has not shown me your octagon and/or the octagon in a function.
Javascript It’s not JAVA. What do these all have in common?
1 Programmer-Defined Functions Functions allow program modularization Variables declared in function are local variables Only known inside function in.
The Web Warrior Guide to Web Design Technologies
Functions Jay Summet. Aug Functions A function is a piece of code you can use over and over again Treat it like a black box You pass it (optional)
Executes a statement or statements for a number of times – iteration. Syntax for(initialize; test; increment) { // statements to be executed } Initial.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
Tutorial 10 Programming with JavaScript
XP 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial 10.
2012 •••••••••••••••••••••••••••••••••• Summer WorkShop Mostafa Badr
INTRODUCTION TO PYTHON PART 2 INPUT AND OUTPUT CSC482 Introduction to Text Analytics Thomas Tiahrt, MA, PhD.
Programming with JavaScript (Chapter 10). XP Various things Midterm grades: Friday Winter Career Fair – Thursday, April 28, 2011 (11 am to 3 pm). – MAC.
C++ Basics Structure of a Program. C++ Source Code Plain text file Typical file extension .CPP Must compile the C++ source code without errors before.
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.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
Tutorial 10 Programming with JavaScript. XP Objectives Learn the history of JavaScript Create a script element Understand basic JavaScript syntax Write.
Tutorial 10 Programming with JavaScript
Done by: Hanadi Muhsen1 Tutorial 1.  Learn the history of JavaScript  Create a script element  Write text to a Web page with JavaScript  Understand.
Matlab Basics Tutorial. Vectors Let's start off by creating something simple, like a vector. Enter each element of the vector (separated by a space) between.
Ruby on Rails. What is Ruby? Programming Language Object-oriented Interpreted.
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
JavaScript Syntax, how to use it in a HTML document
Introduction to Computer Programming
Introduction into JavaScript Java 1 JavaScript JavaScript programs run from within an HTML document The statements that make up a program in an HTML.
COP 3813 Intro to Internet Computing Prof. Roy Levow Lecture 4 JavaScript.
CHAPTER 3 FUNCTIONS, METHODS & OBJECTS WHAT IS A FUNCTION?
4.3 Functions. Functions Last class we talked about the idea and organization of a function. Today we talk about how to program them.
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
1 Looping Dale/Weems/Headington. 2 KA/JS/P Warning l Save your work often! l In the Khan Academy, JavaScript environment, infinite loops will lock up.
JavaScript 101 Introduction to Programming. Topics What is programming? The common elements found in most programming languages Introduction to JavaScript.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Javascript Overview. What is Javascript? May be one of the most popular programming languages ever Runs in the browser, not on the server All modern browsers.
CHAPTER 10 ERROR HANDLING & DEBUGGING JavaScript can be hard to learn. Everyone makes mistakes when writing it.
Learn to code- JavaScript. Prt 1. TUTOR: DRKALMENIUS.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Beginning JavaScript 4 th Edition. Chapter 1 Introduction to JavaScript and the Web.
Computer Programming II Lecture 4. Functions - In C++ we use modules to divide the program into smaller and manageable code. These modules are called.
JavaScript and AJAX 2nd Edition Tutorial 1 Programming with JavaScript.
XP Tutorial 10New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
© 2010 Robert K. Moniot1 Chapter 6 Introduction to JavaScript.
REEM ALMOTIRI Information Technology Department Majmaah University.
Agenda Introduction Computer Programs Python Variables Assignment
User-Written Functions
“Under the hood”: Angry Birds Maze
Tutorial 10 Programming with JavaScript
1-1 Logic and Syntax A computer program is a solution to a problem.
Nick Sims Scripting Languages.
JavaScript Loops.
Functions.
JavaScript: Functions.
4-2 Functions in C In C, the idea of top–down design is done using functions. A C program is made of one or more functions, one and only one of which.
Event Driven Programming & User Defined Functions
Programming Right from the Start with Visual Basic .NET 1/e
T. Jumana Abu Shmais – AOU - Riyadh
Algorithms Take a look at the worksheet. What do we already know, and what will we have to learn in this term?
JavaScript MCS/BCS.
Computer Science Core Concepts
Tutorial 10 Programming with JavaScript
Functions Jay Summet.
4-2 Functions in C In C, the idea of top–down design is done using functions. A C program is made of one or more functions, one and only one of which.
The structure of programming
Tutorial 10: Programming with javascript
Functions Jay Summet.
Matlab Basics Tutorial
CPS125.
Javascript Functions.
Intro to Programming (in JavaScript)
Presentation transcript:

Web Design II Flat Rock Community Schools JavaScript Functions Web Design II Flat Rock Community Schools

What is a Function? A way to pull out a “block of code” and save it so it can be “called out” whenever you want. Function say_hello( ) { console.log (‘hello’); Console.log (‘world’); }

Declaration

Function Definition Con’t.. A JavaScript function is a "recipe" of instructions (i.e., statements or commands) whose purpose is to accomplish a well-defined task. When the JavaScript interpreter (i.e., your browser) executes a function, it processes these instructions, one by one, until there are no more instructions in the function to execute. For example, a JavaScript function whose purpose is to compute the square of a number might be defined as follows: function square (number) { var result = number * number; return result; }

Parenthesis & Parameters Parenthesis allow you to pass information into your function so you can use it later – aka Parameters

Adding more than one Parameter

Returns Some functions can be thought of as "processing units" that accept data from one end and produce results at the other. A function's input is called its parameters; its output is called the return value.

Assigning a Function to a Variable

What does console.log really mean? “console” is an object that holds various info. and functions that can be used in order to log out information into the development console (node/web browser) to show that it’s running properly. “log” is a function in console that writes any text you may have into the development console (node/browser)