Разделы презентаций


Module 2: Functions in JavaScript D. Petin 05/2014

AgendaFunctions in JS Input and OutputJS Code ProcessingDeclaration and Expression[1][2][3][4]

Слайды и текст этой презентации

Слайд 1Module 2: Functions in JavaScript


D. Petin

05/2014

Module 2:  Functions in JavaScriptD. Petin05/2014

Слайд 2Agenda
Functions in JS
Input and Output
JS Code Processing
Declaration and Expression

[1]
[2]
[3]
[4]

AgendaFunctions in JS Input and OutputJS Code ProcessingDeclaration and Expression[1][2][3][4]

Слайд 3
Functions in JS

Functions in JS

Слайд 4Basic Information
In mathematics:



In classical programming

[3]
Function is a relation between a

set of inputs and a set of permissible outputs.
[1]
[2]
y

= f(x)

Function is a named part of a code that performs a distinct service.

Basic InformationIn mathematics:In classical programming[3]Function is a relation between a set of inputs and a set of

Слайд 5Example
var i, base, power, result;

base = 2; power = 2;

result = 1;

for(i = 0; i < power; i++)

{
result *= base;
}
console.log(result);

base = 3; power = 4; result = 1;

for(i = 0; i < power; i++) {
result *= base;
}
console.log(result);

[1]

[2]

[3]

[4]

[5]

Examplevar i, base, power, result;base = 2; power = 2; result = 1; for(i = 0; i

Слайд 6Declaration of function
function is a special keyword for creation of

function in JavaScript.
function name () {
body;
}
[1]
[2]

Declaration of functionfunction is a special keyword for creation of function in JavaScript.function name () {

Слайд 7Example
var i, base, power, result;

base = 2; power = 2;

result = 1;

for(i = 0; i < power; i++)

{
result *= base;
}
console.log(result);

base = 3; power = 4; result = 1;

for(i = 0; i < power; i++) {
result *= base;
}
console.log(result);
Examplevar i, base, power, result;base = 2; power = 2; result = 1; for(i = 0; i

Слайд 8Example
function pow () {
result = 1;
for

(i = 0; i < power; i++) {

result *= base;
}
}
Examplefunction pow () {  result = 1;  for (i = 0; i < power; i++)

Слайд 9Function call
Call - operation for execution of function.

( )

– operator for this action.

Usually function can be called

by name.


[1]

[2]

[3]

Function callCall - operation for execution of function. ( ) – operator for this action. Usually function

Слайд 10Example
var i, base, power, result;

base = 2; power = 2;


pow();
console.log(result);

base = 3; power = 4;
pow();
console.log(result);

function pow () {

result = 1;
for(i = 0; i < power; i++) {
result *= base;
}
}
Examplevar i, base, power, result;base = 2; power = 2; pow();console.log(result);base = 3; power = 4; pow();console.log(result);function

Слайд 11
Input and Output

Input and Output

Слайд 12Input and Output
function name (a, b) {
return a

+ b;
}
[1]
* you can return one value only
* return

always interrupts the execution.
* place your return at the end of a function

[2]

[3]

[3]

Input and Outputfunction name (a, b) {  return a + b;} [1]* you can return one

Слайд 13Example
function pow () {
result = 1;
for

(i = 0, I < power; i++) {

result *= base;
}
}
Examplefunction pow () {  result = 1;  for (i = 0, I < power; i++)

Слайд 14Example
function pow (base, power) {
var result = 1;

for (i = 0, I < power; i++) {

result *= base;
}
return result;
}
Examplefunction pow (base, power) {  var result = 1;  for (i = 0, I <

Слайд 15Example
var i, out;

out = pow(2, 2);
console.log(out);

out = pow(3, 4);
console.log(out);

function pow

(base, power) {
var result = 1;

for(i = 0; i < power; i++) {
result *= base;
}
return result;
}
Examplevar i, out;out = pow(2, 2);console.log(out);out = pow(3, 4);console.log(out);function pow (base, power) {  var result =

Слайд 16
JS Code Processing

JS Code Processing

Слайд 17Code processing
var a = 10;
test();
function test () {
a

= 30;
var b = 40;
}
var b = 20;
console.log(a,

b);
Code processingvar a = 10;test();function test () {  a = 30;  var b = 40;}var

Слайд 18Code processing
var a = 10;
test();
function test () {
a

= 30;
var b = 40;
}
var b = 20;
console.log(a,

b);

1.

Code processingvar a = 10;test();function test () {  a = 30;  var b = 40;}var

Слайд 19Code processing
var a = 10;
test();
function test () {
a

= 30;
var b = 40;
}
var b = 20;
console.log(a,

b);

1.

2.

3.

Code processingvar a = 10;test();function test () {  a = 30;  var b = 40;}var

Слайд 20Code processing
var a = 10;
test();
function test () {
a

= 30;
var b = 40;
}
var b = 20;
console.log(a,

b);

1.

2.

3.

4.

5.

6.

Code processingvar a = 10;test();function test () {  a = 30;  var b = 40;}var

Слайд 21Code processing
var a = 10;
test();
function test () {
a

= 30;
var b = 40;
}
var b = 20;
console.log(a,

b);

1.

2.

3.

4.

5.

6.

5.1

5.2

Code processingvar a = 10;test();function test () {  a = 30;  var b = 40;}var

Слайд 22
Declaration and Expression

Declaration and Expression

Слайд 23Declaration and Expression
function name () {
body;
}
[1]
var name

= function () {
body;
};
[2]

Declaration and Expressionfunction name () {  body;} [1]var name = function () {   body;};

Слайд 24Additional Facts About Functions
Functions in JavaScript are Objects.

As a result,

functions are accessible by reference.

Functions can be used as a

parameter in other function.

References to functions can be saved in any other variable.

[1]

[2]

[3]

[4]

Additional Facts About FunctionsFunctions in JavaScript are Objects.As a result, functions are accessible by reference.Functions can be

Обратная связь

Если не удалось найти и скачать доклад-презентацию, Вы можете заказать его на нашем сайте. Мы постараемся найти нужный Вам материал и отправим по электронной почте. Не стесняйтесь обращаться к нам, если у вас возникли вопросы или пожелания:

Email: Нажмите что бы посмотреть 

Что такое TheSlide.ru?

Это сайт презентации, докладов, проектов в PowerPoint. Здесь удобно  хранить и делиться своими презентациями с другими пользователями.


Для правообладателей

Яндекс.Метрика