Что такое findslide.org?

FindSlide.org - это сайт презентаций, докладов, шаблонов в формате PowerPoint.


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

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

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

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

Презентация на тему 06-Understanding JavaScript and Coding Essentials

Содержание

AgendaBasic InformationHow to include JS Code into HTMLCommentsVariablesData TypesType CastingFunctions in JS Input and OutputJS Code ProcessingDeclaration and Expression
Understanding JavaScript and Coding EssentialsVyacheslav Koldovskyy Last update: 27/08/2015 AgendaBasic InformationHow to include JS Code into HTMLCommentsVariablesData TypesType CastingFunctions in JS Basic Information about JavaScript Basic informationJavaScript - dynamic computer programming language.It is most commonly used as Basic informationJS take many names and naming conventions from Java, but the How to include JS Code into HTML Including of JavaScriptExist three ways to include script into HTML page: Inline Inline including…. Unfortunately, this is the worst solution. Holistic code will be Inside tag f() ;Sometimes it makes sense. But in the general case, In separate fileThis is the best way. Code is holistic. It’s easy Comments CommentsComments - part of the program text which will be ignored by Variables VariablesVariable – symbolic name associated with a value and whose associated value Declaration and initializationvar – special keyword for declaration of variablesIn JavaScriptvar variable; Global and localJavaScript has two types of variables: global - exist in Data Types Data typesJavaScript have 6 base data types: Number – scalar type for Number, Boolean and Stringvar n = 10; or var n = Number(10); Null and Undefinedvar n = null; //null variables can have only null Type Casting Type castingvar a, b, c; a = 10; b = true; c Type castingBase rules of typing casting:All scalar types try to convert itself Functions in JS Basic InformationIn mathematics:In classical programming[3]Function is a relation between a set of Examplevar i, base, power, result;base = 2; power = 2; result = Declaration of functionfunction is a special keyword for creation of function in Examplevar i, base, power, result;base = 2; power = 2; result = Examplefunction pow () {  result = 1;  for (var i Function callCall - operation for execution of function. ( ) – operator Examplevar base, power, result;base = 2; power = 2; pow();console.log(result);base = 3; Input and Output Input and Outputfunction name (a, b) {  return a + b;} Examplefunction pow () {  result = 1;  for (var i Examplefunction pow (base, power) {  var result = 1;  for Examplevar out;out = pow(2, 2);console.log(out);out = pow(3, 4);console.log(out);function pow (base, power) { JS Code Processing Code processingvar a = 10;test();function test () {  a = 30; Code processingvar a = 10;test();function test () {  a = 30; Code processingvar a = 10;test();function test () {  a = 30; Code processingvar a = 10;test();function test () {  a = 30; Code processingvar a = 10;test();function test () {  a = 30; Declaration and Expression Declaration and Expressionfunction name () {  body;} [1]var name = function Additional Facts About FunctionsFunctions in JavaScript are Objects.As a result, functions are Practice Task Thank You!Copyright © 2010 SoftServe, Inc.ContactsEurope Headquarters 52 V. Velykoho Str.Lviv 79053,
Слайды презентации

Слайд 2 Agenda
Basic Information
How to include JS Code into HTML
Comments
Variables
Data

AgendaBasic InformationHow to include JS Code into HTMLCommentsVariablesData TypesType CastingFunctions in

Types
Type Casting
Functions in JS
Input and Output
JS Code Processing
Declaration

and Expression



Слайд 3

Basic Information about JavaScript

Basic Information about JavaScript

Слайд 4 Basic information
JavaScript - dynamic computer programming language.

It is

Basic informationJavaScript - dynamic computer programming language.It is most commonly used

most commonly used as part of web browsers, whose

implementations allow client-side to interact with the user, control the browser and asynchronously communicate with server-side.

JavaScript syntax was influenced by C.

Слайд 5 Basic information
JS take many names and naming conventions

Basic informationJS take many names and naming conventions from Java, but

from Java, but the two languages are otherwise unrelated

and have very different semantics.

JavaScript is a prototype-based scripting language with dynamic typing.

JS supported object-oriented, imperative and functional programming styles.

[1]

[2]

[3]


Слайд 6

How to include JS Code into HTML

How to include JS Code into HTML

Слайд 7 Including of JavaScript
Exist three ways to include script

Including of JavaScriptExist three ways to include script into HTML page:

into HTML page:

Inline in HTML
Inside tag



Слайд 11

Comments

Comments

Слайд 12 Comments
Comments - part of the program text which

CommentsComments - part of the program text which will be ignored

will be ignored by language interpreter

The /* characters, followed by

any sequence of characters (including new lines), followed by the */ characters.
The // characters, followed by any sequence of characters, but only in current line. Therefore, it is commonly called a "single-line comment."


[1]

[2]

[3]


Слайд 13

Variables

Variables

Слайд 14 Variables
Variable – symbolic name associated with a value

VariablesVariable – symbolic name associated with a value and whose associated

and whose associated value may be changed.
Declaration – process

of variable's specifying. Usually declaration consist of defining: type, name and default value of variable.

A process in which a variable is set to its first value is called initialization.

[1]

[2]

[3]


Слайд 15 Declaration and initialization
var – special keyword for declaration

Declaration and initializationvar – special keyword for declaration of variablesIn JavaScriptvar

of variables
In JavaScript

var variable; //declaration
variable =

10; //initialization

Or quickly


var variable = 10;

[1]

[2]

[3]


Слайд 16 Global and local
JavaScript has two types of variables:

Global and localJavaScript has two types of variables: global - exist

global - exist in memory and is available at

all times of the program. In JS it's a variables of page.
local - exist in memory and is available only in block when variable is defined. In JS it's defined in function variables.

[1]

[2]


Слайд 17

Data Types

Data Types

Слайд 18 Data types
JavaScript have 6 base data types:

Number

Data typesJavaScript have 6 base data types: Number – scalar type

– scalar type for integer and real digits
Boolean

– scalar type for logical values
String – special type for work with text information
Undefined – special type for uninitialized variables
Null – special type for "cleaning" of variables
Object – complex type for service and user needs

Слайд 19 Number, Boolean and String


var n = 10; or

Number, Boolean and Stringvar n = 10; or var n =

var n = Number(10);
//number values for example: -1,

10, 3.14, Nan, Infinity


var s = “text”; or var s = String(“text”);
//string values for example: “”, “text”, ‘text’

var b = true; or var b = Boolean(true);
//bollean values: true and false

[1]

[2]

[3]


Слайд 20 Null and Undefined


var n = null;
//null variables

Null and Undefinedvar n = null; //null variables can have only

can have only null value
var u;
// created and

uninitialized

And Object type… but it will be reviewed in future :)

[1]


Слайд 21

Type Casting

Type Casting

Слайд 22 Type casting

var a, b, c;
a = 10;

Type castingvar a, b, c; a = 10; b = true;


b = true;
c = a + b;

var a,

b, c;
a = 10;
b = true;
c = a + Number(b);

Exist two types of casting:

Implicit

Explicit

But both ways given c =11 as a result!

[2]

[1]

[3]


Слайд 23 Type casting
Base rules of typing casting:

All scalar types

Type castingBase rules of typing casting:All scalar types try to convert

try to convert itself to largest scalar type: Boolean

to Number, Number to String.
If Boolean converted to String it at first converted to Number and after them Number to String.
In mathematical operations (excluding +) String should be converted to Number.
Null and Undefined converted to String as “null” and “undefined”, and to Number as a 0 and NaN

[1]

[2]

[3]

[4]


Слайд 24

Functions in JS

Functions in JS

Слайд 25 Basic Information
In mathematics:



In classical programming

[3]
Function is a relation

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

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.


Слайд 26 Example

var i, base, power, result;

base = 2; power

Examplevar i, base, power, result;base = 2; power = 2; result

= 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]


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

Declaration of functionfunction is a special keyword for creation of function

creation of function in JavaScript.

function name () {

body;
}

[1]

[2]


Слайд 28 Example

var i, base, power, result;

base = 2; power

Examplevar i, base, power, result;base = 2; power = 2; result

= 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);

Слайд 29 Example

function pow () {
result = 1;

Examplefunction pow () { result = 1; for (var i =

for (var i = 0; i < power;

i++) {
result *= base;
}
}

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

Function callCall - operation for execution of function. ( ) –



( ) – operator for this action.

Usually function

can be called by name.


[1]

[2]

[3]


Слайд 31 Example

var base, power, result;

base = 2; power =

Examplevar base, power, result;base = 2; power = 2; pow();console.log(result);base =

2;
pow();
console.log(result);

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

function pow

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

Слайд 32

Input and Output

Input and Output

Слайд 33 Input and Output

function name (a, b) {

Input and Outputfunction name (a, b) { return 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]


Слайд 34 Example

function pow () {
result = 1;

Examplefunction pow () { result = 1; for (var i =

for (var i = 0, i < power;

i++) {
result *= base;
}
}

Слайд 35 Example

function pow (base, power) {
var result

Examplefunction pow (base, power) { var result = 1; for (var

= 1;
for (var i = 0, i

< power; i++) {
result *= base;
}
return result;
}

Слайд 36 Example

var out;

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

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

function

Examplevar out;out = pow(2, 2);console.log(out);out = pow(3, 4);console.log(out);function pow (base, power)

pow (base, power) {
var result = 1;


for(var i = 0; i < power; i++) {
result *= base;
}
return result;
}

Слайд 37

JS Code Processing

JS Code Processing

Слайд 38 Code processing



var a = 10;
test();
function test () {

Code processingvar a = 10;test();function test () { a = 30;

a = 30;
var b = 40;
}
var

b = 20;
console.log(a, b);

Слайд 39 Code processing



var a = 10;
test();
function test () {

Code processingvar a = 10;test();function test () { a = 30;

a = 30;
var b = 40;
}
var

b = 20;
console.log(a, b);


1.


Слайд 40 Code processing


var a = 10;
test();
function test () {

Code processingvar a = 10;test();function test () { a = 30;

a = 30;
var b = 40;
}
var

b = 20;
console.log(a, b);


1.



2.

3.


Слайд 41 Code processing



var a = 10;
test();
function test () {

Code processingvar a = 10;test();function test () { a = 30;

a = 30;
var b = 40;
}
var

b = 20;
console.log(a, b);


1.



2.

3.




4.

5.

6.


Слайд 42 Code processing


var a = 10;
test();
function test () {

Code processingvar a = 10;test();function test () { a = 30;

a = 30;
var b = 40;
}
var

b = 20;
console.log(a, b);


1.



2.

3.


4.

5.

6.



5.1

5.2




Слайд 43

Declaration and Expression

Declaration and Expression

Слайд 44 Declaration and Expression

function name () {
body;
}

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


[1]

var name = function () {
body;
};


[2]


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

As

Additional Facts About FunctionsFunctions in JavaScript are Objects.As a result, functions

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]


Слайд 46 Practice Task

Practice Task

  • Имя файла: 06-understanding-javascript-and-coding-essentials.pptx
  • Количество просмотров: 120
  • Количество скачиваний: 0