Application of Residue Theorem to evaluate real integrations.pptx
LO-2 Chapter-1.pptx
1. Chapter 1
Basics of JavaScript Programming
K. K. Wagh Polytechnic, Nashik-3
Prof.P.S.Chavan
CO605.1: Create interactive web pages using program flow
control structure.
2. Object Properties:
Object Name:
• Object is entity. In JavaScript document, window, forms, fields,
buttons are some properly used objects.
• Each object is identified by ID or name.
• Array of objects or Array of collections can also be created.
Property:
• It is the value associated with each object.
• Each object has its own set of properties.
Method:
• It is a function or process associated with each object.
• Ex: for document object write is a method.
Dot Syntax: Used to access properties and methods of object.
Main Event: Event causes JavaScript to execute the code. In JavaScript
when user submits form, clicks button, writes something to text box the
corresponding event gets triggered and execution of appropriate code is
done through Event Handling.
Prof.P.S.Chavan
3. Values:
Values:
It uses six types of values:
• Number: It is numeric value can be integer or float.
• String: It is a collection of characters. Enclosed within single or
double quote.
• Boolean: It contains true and false values. Values can be compared
with variables and can be used in assignment statement.
• Null: This value can be assigned by reserved word ‘null’. It means no
value. If we try to access null value error will occur.
• Object: It is the entity that represents some value. Ex: Form is an
object on which some components can be placed and used.
• Function: It is intended for execution of some task. There are
predefined and user defined functions. The ‘function’ keyword is used
to define function.
Prof.P.S.Chavan
4. Keywords:
• These are the reserved words having some special meaning associated
with it.
abstract else instanceof super
boolean enum int switch
break export interface synchronized
byte extends let this
case false long throw
catch final native throws
char finally new transient
class float null true
const for package try
continue function private typeof
debugger goto protected var
default if public void
delete implements return volatile
do import short while
double in static with
Prof.P.S.Chavan
5. Operators and Expressions:
Prof.P.S.Chavan
Sr.
No.
Type Operator Meaning Example
1. Arithmetic + Addition or Unary plus c=a+b
- Subtraction or Unary
minus
d=-a
* Multiplication c=a*b
/ Division c=a/b
% Mod c=a%b
2. Logical && AND Operator 0&&1
|| OR Operator 0 | | 1
3. Increment ++ Increment by one ++i or i++
4. Decrement -- Decrement by one --i or i--
5. Conditional ? : Conditional Operator a>b?true:false
6. Operators and Expressions cont.:
Prof.P.S.Chavan
Sr.
No.
Type Operator Meaning Example
6. Assignment = Is assigned to a=5
+= Add a value then assign a+=5 (a=a+5)
-= Subtract a value then assign a-=5(a=a-5)
*= Multiply a value then assign a*=5(a=a*5)
/= Divide a value then assign a/=5(a=a/5)
7. Relational < Less than a<4
> Greater than a>4
<= Less than equal to a<=4
>= Greater than equal to a>=4
== Equal to a==4
!= Not Equal to a!=4
=== equal value and equal type a===5
!== not equal value or not equal
type
a!==5
7. JavaScript Expressions
• Expressions
• Any unit of code that can be evaluated to a
value is an expression.
• Since expressions produce values, they can
appear anywhere in a program where
JavaScript expects a value such as the
arguments of a function invocation.
Prof.P.S.Chavan
8. 1.Primary Expressions:
• Primary expressions refer to stand alone
expressions such as literal values, certain
keywords and variable values. Examples include
the following:
• 'hello world'; // A string literal
23; // A numeric literal
true; // Boolean value true
sum; // Value of variable sum
this; // A keyword that evaluates to the current
object
Prof.P.S.Chavan
9. 2.Arithmetic Expressions:
• Arithmetic expressions evaluate to a numeric
value. Examples include the following
• 10; // Here 10 is an expression that is
evaluated to the numeric value 10 by the JS
interpreter.
• 10+13; // This is another expression that is
evaluated to produce the numeric value 23
Prof.P.S.Chavan
10. 3.String Expressions:
• String expressions are expressions that
evaluate to a string. Examples include the
following
• 'hello';
'hello' + 'world'; // evaluates to the string
'hello world'
Prof.P.S.Chavan
11. 4.Logical Expressions
• Expressions that evaluate to the boolean value
true or false are considered to be logical
expressions. This set of expressions often
involve the usage of logical operators &&
(AND), ||(OR) and !(NOT). Examples include
• 10 > 9; // evaluates to boolean value true
10 < 20; // evaluates to boolean value false
• true; //evaluates to boolean value true
• a===20 && b===30; // evaluates to true or
false based on the values of a and b
Prof.P.S.Chavan
12. 5.Left-hand-side Expressions:
• Also known as lvalues, left-hand-side
expressions are those that can appear on the
left side of an assignment expression.
Examples of left-hand-side expressions include
the following:
• // variables such as i and total
i = 10;
total = 0;
Prof.P.S.Chavan
13. 6.Assignment Expressions:
• When expressions use the = operator to assign
a value to a variable, it is called an assignment
expression. Examples include
• average = 55;
Prof.P.S.Chavan
14. 7.Object and Array Initializers
• These initializer expressions are sometimes called
“object literals” and “array literals.” Unlike true
literals, however, they are not primary
expressions, because they include a number of
subexpressions that specify property and element
values.
• Array initializers have a slightly simpler syntax,
and we’ll begin with those.
• An array initializer is a comma-separated list of
expressions contained within square brackets.
• Prof.P.S.Chavan
15. Prof.P.S.Chavan
[] // An empty array: no expressions inside
brackets means no elements
[1+2,3+4] // A 2-element array. First element is 3,
second is 7
16. Function Definition Expressions
• In a sense, a function definition expression is a
“function literal” in the same way that an object
initializer is an “object literal.”
• A function definition expression typically consists
of the keyword function followed by a comma-
separated list of zero or more identifiers (the
parameter names) in parentheses and a block of
JavaScript code (the function body) in curly
braces. For example:
Prof.P.S.Chavan
18. 8.Property Access Expressions
• A property access expression evaluates to the
value of an object property or an array
element. JavaScript defines two syntaxes for
property access:
• expression . identifier
• expression [ expression ]
Prof.P.S.Chavan
19. 9.Invocation Expressions
• An invocation expression is JavaScript’s syntax
for calling (or executing) a function or method.
• f(0) // f is the function expression; 0 is
the argument expression.
• Math.max(x,y,z) // Math.max is the function;
x, y and z are the arguments.
• a.sort() // a.sort is the function; there are
no arguments.
Prof.P.S.Chavan