SlideShare a Scribd company logo
1 of 17
Type conversion and Escape
characters
GROUP MEMBERS
ABDUL WAHEED E-18
MUNEEB SHAHID E-44
ALI RAZA E-07
SALAHULDIN E-26
UMAR FAROOQ E-28
Escape Characters
 Escape characters are the special characters used in format string to modify
the format of output. These characters are not displayed in output. These
characters are always starts with “”. The backslash is called escape character.
A character preceded by a backslash () is an escape sequence and has a
special meaning to the compiler.
b Backspace
t Tab
n New line
r Carriage return
f Form Feed
’ Single quote
” Double quote
Backspace “b”
This escape character is used to insert backspace in output.
For Example
console.log( 'Hellobworld! ' ); will display
Hellworld
Form Feed “f”
This escape character is use to insert to blank paper in
output .It is called form feed.
For Example:
console.log( 'Hellofworld! ' ); will display
Helloworld
After printing the “Hello” the system will include a blank
paper then print the “world”.
New line “n”
This escape character is use to insert new line in the output .
For Example:
console.log( 'Hellonworld! ' ); will display
Hello
World
Carriage return “r”
This escape character is use to move the cursor at the beginning of the
current line.
For Example:
console.log( 'Hellorworld! ' ); will display
World"
Tab “t”
This escape character is use to insert a tab in the output.
console.log( 'Hellotworld! ' ); will display
Hello world
Single quote ” ’ ”
This escape character is use to display single quote in output.
console.log( 'Hello’world!’ ' ); will display
Hello ‘world’
Double quotes ”
This escape character is use to display double quote in output.
console.log( 'Hello”world!” ' ); will display
Hello “ world”
Type Conversion in JavaScript
Type conversion :or typecasting refers to changing an entity of one datatype into another.
Types: There are two types of conversion in JavaScript.
1. Implicit
2. Explicit
Implicit:
Implicit type conversion in which conversion occur automatically by complier.
Var x=23;
Var str=“ mango people”;
Var result= x+str;
result= 23mangopeople
Automatic Conversions:
When one type of data is assigned to another type of variable ,an automatic type
conversion will take place if the following two conditions are met:
 The two types are compatible.
 The destination type is larger than the source type.
Example:
The int type is always large enough to hold all valid byte values, no explicit cast
statement is required.
 Explicit :
 Explicit type conversion is a type conversion which is explicitly defined within a
program (instead of being done by a compiler for implicit type conversion). It is
defined by the user in the program.
 JavaScript provides three function which are used to perform the explicit type
conversion.
1. eval()
2. parseInt()
3. parseFloat().
Eval Function().
 The eval function can be used to convert the string expression to a numberic value.
Example:
 The statement total = eval(“432.1*10”) result in the value 4321 being assigned to the
total variable .
 The eval() function takes the string value “432.1*10” as parameter and return the
numeric value 4321 as the result of function call.
 If the string value passed as a parameter to the eval() function does not represent a
numeric value, then the use of eval() result in an error being generated.
document.write('eval("12.34*10")=');
document.write(eval("12.34*10"));
Result-- eval("12.34*10")=123
parseInt() function:
 The parseInt() function is used to convert a string value to a integer.
 parseInt() function returns the first integer contained in the string or 0 if
the string does not begin with an integer.
Example:
 ParseInt(“123xyz”) returns 123 and parseInt(“xyz”) returns 0.
document.write('parseInt("0*10")=');
document.write(parseInt("0*10"));
Result --parseInt("0*10")=0
parsefloat() function:
 parsefloat() function is similar to the parseInt() function.
 It returns the first floating point number contained in the string or 0 when
the string does not begin with a valid floating point number.
Example:
 parseFloat(“2.1e4xyz”) returns 21000 and parseFloat(“xyz”) returns
0.
document.write('parseFloat("5.4321e6")=');
document.write(parseFloat("5.4321e6"));
parseFloat("5.4321e6")=5432100
Convert String to integer
Example
 parseInt("4");
 parseInt("5aaa");
 parseInt("4.33333");
 parseInt("aaa");
Result
 4
 5
 4
 NaN(Not a number)
Converting float to integer
Example
 parseInt(5.133);
 <script language="javascript">
var a = "334";
var b = 3;
var c = parseInt(a)+b;
var d = a+b;
document.write("parseInt(a)+b = "+c);
</script>
Result
 5
 parseInt(a)+b = 337
Converting String to Float
Example
 parseFloat("4.333");
 parseFloat("5aaa");
 parseFloat("aaa");
Result
 4.333
 5
 NaN(Not a number)
Converting Integer to String
Example
 var a = 3.22;
a.toString();
 var a = 5;
a.toString();
 <script language="javascript">
var a = 32;
var b = 333;
var c = a.toString()+b;
document.write(" to String function
"+c);
</script>
Result
 3.22
 5
 32333

More Related Content

What's hot

Swift 3.0 の新しい機能(のうちの9つ)
Swift 3.0 の新しい機能(のうちの9つ)Swift 3.0 の新しい機能(のうちの9つ)
Swift 3.0 の新しい機能(のうちの9つ)Tomohiro Kumagai
 
C Programming Language Part 6
C Programming Language Part 6C Programming Language Part 6
C Programming Language Part 6Rumman Ansari
 
JavaScript: Variables and Functions
JavaScript: Variables and FunctionsJavaScript: Variables and Functions
JavaScript: Variables and FunctionsJussi Pohjolainen
 
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypesVarun C M
 
Swift 3.0 で変わったところ - 厳選 13 項目 #love_swift #cswift
Swift 3.0 で変わったところ - 厳選 13 項目 #love_swift #cswiftSwift 3.0 で変わったところ - 厳選 13 項目 #love_swift #cswift
Swift 3.0 で変わったところ - 厳選 13 項目 #love_swift #cswiftTomohiro Kumagai
 
operators and expressions in c++
 operators and expressions in c++ operators and expressions in c++
operators and expressions in c++sanya6900
 
Intro to Javascript
Intro to JavascriptIntro to Javascript
Intro to JavascriptAnjan Banda
 
Lecture 2 C++ | Variable Scope, Operators in c++
Lecture 2 C++ | Variable Scope, Operators in c++Lecture 2 C++ | Variable Scope, Operators in c++
Lecture 2 C++ | Variable Scope, Operators in c++Himanshu Kaushik
 
The Functional Programming Triad of fold, scan and iterate
The Functional Programming Triad of fold, scan and iterateThe Functional Programming Triad of fold, scan and iterate
The Functional Programming Triad of fold, scan and iteratePhilip Schwarz
 
Function overloading(C++)
Function overloading(C++)Function overloading(C++)
Function overloading(C++)Ritika Sharma
 
I can't get my code below to work with Option Strict On due to this part of t...
I can't get my code below to work with Option Strict On due to this part of t...I can't get my code below to work with Option Strict On due to this part of t...
I can't get my code below to work with Option Strict On due to this part of t...hwbloom115
 
JavaScript - Chapter 5 - Operators
 JavaScript - Chapter 5 - Operators JavaScript - Chapter 5 - Operators
JavaScript - Chapter 5 - OperatorsWebStackAcademy
 

What's hot (20)

Java 2
Java 2Java 2
Java 2
 
Swift 3.0 の新しい機能(のうちの9つ)
Swift 3.0 の新しい機能(のうちの9つ)Swift 3.0 の新しい機能(のうちの9つ)
Swift 3.0 の新しい機能(のうちの9つ)
 
C Programming Language Part 6
C Programming Language Part 6C Programming Language Part 6
C Programming Language Part 6
 
JavaScript: Variables and Functions
JavaScript: Variables and FunctionsJavaScript: Variables and Functions
JavaScript: Variables and Functions
 
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
 
Tut Constructor
Tut ConstructorTut Constructor
Tut Constructor
 
Swift 3.0 で変わったところ - 厳選 13 項目 #love_swift #cswift
Swift 3.0 で変わったところ - 厳選 13 項目 #love_swift #cswiftSwift 3.0 で変わったところ - 厳選 13 項目 #love_swift #cswift
Swift 3.0 で変わったところ - 厳選 13 項目 #love_swift #cswift
 
Variables
VariablesVariables
Variables
 
operators and expressions in c++
 operators and expressions in c++ operators and expressions in c++
operators and expressions in c++
 
Intro to Javascript
Intro to JavascriptIntro to Javascript
Intro to Javascript
 
Lecture 2 C++ | Variable Scope, Operators in c++
Lecture 2 C++ | Variable Scope, Operators in c++Lecture 2 C++ | Variable Scope, Operators in c++
Lecture 2 C++ | Variable Scope, Operators in c++
 
03 function overloading
03 function overloading03 function overloading
03 function overloading
 
Lecture 13 - Storage Classes
Lecture 13 - Storage ClassesLecture 13 - Storage Classes
Lecture 13 - Storage Classes
 
Lecture 14 - Scope Rules
Lecture 14 - Scope RulesLecture 14 - Scope Rules
Lecture 14 - Scope Rules
 
The Functional Programming Triad of fold, scan and iterate
The Functional Programming Triad of fold, scan and iterateThe Functional Programming Triad of fold, scan and iterate
The Functional Programming Triad of fold, scan and iterate
 
Java scriptfunction
Java scriptfunctionJava scriptfunction
Java scriptfunction
 
operators in c++
operators in c++operators in c++
operators in c++
 
Function overloading(C++)
Function overloading(C++)Function overloading(C++)
Function overloading(C++)
 
I can't get my code below to work with Option Strict On due to this part of t...
I can't get my code below to work with Option Strict On due to this part of t...I can't get my code below to work with Option Strict On due to this part of t...
I can't get my code below to work with Option Strict On due to this part of t...
 
JavaScript - Chapter 5 - Operators
 JavaScript - Chapter 5 - Operators JavaScript - Chapter 5 - Operators
JavaScript - Chapter 5 - Operators
 

Similar to Presentatioon on type conversion and escape characters

Csharp4 operators and_casts
Csharp4 operators and_castsCsharp4 operators and_casts
Csharp4 operators and_castsAbed Bukhari
 
COM1407: Type Casting, Command Line Arguments and Defining Constants
COM1407: Type Casting, Command Line Arguments and Defining Constants COM1407: Type Casting, Command Line Arguments and Defining Constants
COM1407: Type Casting, Command Line Arguments and Defining Constants Hemantha Kulathilake
 
Bsc cs i pic u-4 function, storage class and array and strings
Bsc cs i pic u-4 function, storage class and array and stringsBsc cs i pic u-4 function, storage class and array and strings
Bsc cs i pic u-4 function, storage class and array and stringsRai University
 
Diploma ii cfpc u-4 function, storage class and array and strings
Diploma ii  cfpc u-4 function, storage class and array and stringsDiploma ii  cfpc u-4 function, storage class and array and strings
Diploma ii cfpc u-4 function, storage class and array and stringsRai University
 
Btech i pic u-4 function, storage class and array and strings
Btech i pic u-4 function, storage class and array and stringsBtech i pic u-4 function, storage class and array and strings
Btech i pic u-4 function, storage class and array and stringsRai University
 
Functions torage class and array and strings-
Functions torage class and array and strings-Functions torage class and array and strings-
Functions torage class and array and strings-aneebkmct
 
function, storage class and array and strings
 function, storage class and array and strings function, storage class and array and strings
function, storage class and array and stringsRai University
 
Mcai pic u 4 function, storage class and array and strings
Mcai pic u 4 function, storage class and array and stringsMcai pic u 4 function, storage class and array and strings
Mcai pic u 4 function, storage class and array and stringsRai University
 
Python programming: Anonymous functions, String operations
Python programming: Anonymous functions, String operationsPython programming: Anonymous functions, String operations
Python programming: Anonymous functions, String operationsMegha V
 
Functions and pointers_unit_4
Functions and pointers_unit_4Functions and pointers_unit_4
Functions and pointers_unit_4Saranya saran
 
Getting started in c++
Getting started in c++Getting started in c++
Getting started in c++Neeru Mittal
 
Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’eShikshak
 
Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’eShikshak
 
Funcitonal Swift Conference: The Functional Way
Funcitonal Swift Conference: The Functional WayFuncitonal Swift Conference: The Functional Way
Funcitonal Swift Conference: The Functional WayNatasha Murashev
 
Dti2143 chapter 5
Dti2143 chapter 5Dti2143 chapter 5
Dti2143 chapter 5alish sha
 
46630497 fun-pointer-1
46630497 fun-pointer-146630497 fun-pointer-1
46630497 fun-pointer-1AmIt Prasad
 
Functional programming ii
Functional programming iiFunctional programming ii
Functional programming iiPrashant Kalkar
 

Similar to Presentatioon on type conversion and escape characters (20)

Javascript
JavascriptJavascript
Javascript
 
Csharp4 operators and_casts
Csharp4 operators and_castsCsharp4 operators and_casts
Csharp4 operators and_casts
 
COM1407: Type Casting, Command Line Arguments and Defining Constants
COM1407: Type Casting, Command Line Arguments and Defining Constants COM1407: Type Casting, Command Line Arguments and Defining Constants
COM1407: Type Casting, Command Line Arguments and Defining Constants
 
Bsc cs i pic u-4 function, storage class and array and strings
Bsc cs i pic u-4 function, storage class and array and stringsBsc cs i pic u-4 function, storage class and array and strings
Bsc cs i pic u-4 function, storage class and array and strings
 
Diploma ii cfpc u-4 function, storage class and array and strings
Diploma ii  cfpc u-4 function, storage class and array and stringsDiploma ii  cfpc u-4 function, storage class and array and strings
Diploma ii cfpc u-4 function, storage class and array and strings
 
Btech i pic u-4 function, storage class and array and strings
Btech i pic u-4 function, storage class and array and stringsBtech i pic u-4 function, storage class and array and strings
Btech i pic u-4 function, storage class and array and strings
 
Functions torage class and array and strings-
Functions torage class and array and strings-Functions torage class and array and strings-
Functions torage class and array and strings-
 
function, storage class and array and strings
 function, storage class and array and strings function, storage class and array and strings
function, storage class and array and strings
 
Mcai pic u 4 function, storage class and array and strings
Mcai pic u 4 function, storage class and array and stringsMcai pic u 4 function, storage class and array and strings
Mcai pic u 4 function, storage class and array and strings
 
Python programming: Anonymous functions, String operations
Python programming: Anonymous functions, String operationsPython programming: Anonymous functions, String operations
Python programming: Anonymous functions, String operations
 
Functions and pointers_unit_4
Functions and pointers_unit_4Functions and pointers_unit_4
Functions and pointers_unit_4
 
Getting started in c++
Getting started in c++Getting started in c++
Getting started in c++
 
Functions
FunctionsFunctions
Functions
 
Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’
 
Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’
 
Funcitonal Swift Conference: The Functional Way
Funcitonal Swift Conference: The Functional WayFuncitonal Swift Conference: The Functional Way
Funcitonal Swift Conference: The Functional Way
 
Dti2143 chapter 5
Dti2143 chapter 5Dti2143 chapter 5
Dti2143 chapter 5
 
46630497 fun-pointer-1
46630497 fun-pointer-146630497 fun-pointer-1
46630497 fun-pointer-1
 
Functional programming ii
Functional programming iiFunctional programming ii
Functional programming ii
 
2. operator
2. operator2. operator
2. operator
 

Recently uploaded

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 

Recently uploaded (20)

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 

Presentatioon on type conversion and escape characters

  • 1. Type conversion and Escape characters GROUP MEMBERS ABDUL WAHEED E-18 MUNEEB SHAHID E-44 ALI RAZA E-07 SALAHULDIN E-26 UMAR FAROOQ E-28
  • 2. Escape Characters  Escape characters are the special characters used in format string to modify the format of output. These characters are not displayed in output. These characters are always starts with “”. The backslash is called escape character. A character preceded by a backslash () is an escape sequence and has a special meaning to the compiler. b Backspace t Tab n New line r Carriage return f Form Feed ’ Single quote ” Double quote
  • 3. Backspace “b” This escape character is used to insert backspace in output. For Example console.log( 'Hellobworld! ' ); will display Hellworld Form Feed “f” This escape character is use to insert to blank paper in output .It is called form feed. For Example: console.log( 'Hellofworld! ' ); will display Helloworld After printing the “Hello” the system will include a blank paper then print the “world”.
  • 4. New line “n” This escape character is use to insert new line in the output . For Example: console.log( 'Hellonworld! ' ); will display Hello World Carriage return “r” This escape character is use to move the cursor at the beginning of the current line. For Example: console.log( 'Hellorworld! ' ); will display World"
  • 5. Tab “t” This escape character is use to insert a tab in the output. console.log( 'Hellotworld! ' ); will display Hello world Single quote ” ’ ” This escape character is use to display single quote in output. console.log( 'Hello’world!’ ' ); will display Hello ‘world’ Double quotes ” This escape character is use to display double quote in output. console.log( 'Hello”world!” ' ); will display Hello “ world”
  • 6.
  • 7. Type Conversion in JavaScript Type conversion :or typecasting refers to changing an entity of one datatype into another. Types: There are two types of conversion in JavaScript. 1. Implicit 2. Explicit Implicit: Implicit type conversion in which conversion occur automatically by complier. Var x=23; Var str=“ mango people”; Var result= x+str; result= 23mangopeople
  • 8. Automatic Conversions: When one type of data is assigned to another type of variable ,an automatic type conversion will take place if the following two conditions are met:  The two types are compatible.  The destination type is larger than the source type. Example: The int type is always large enough to hold all valid byte values, no explicit cast statement is required.
  • 9.
  • 10.  Explicit :  Explicit type conversion is a type conversion which is explicitly defined within a program (instead of being done by a compiler for implicit type conversion). It is defined by the user in the program.  JavaScript provides three function which are used to perform the explicit type conversion. 1. eval() 2. parseInt() 3. parseFloat().
  • 11. Eval Function().  The eval function can be used to convert the string expression to a numberic value. Example:  The statement total = eval(“432.1*10”) result in the value 4321 being assigned to the total variable .  The eval() function takes the string value “432.1*10” as parameter and return the numeric value 4321 as the result of function call.  If the string value passed as a parameter to the eval() function does not represent a numeric value, then the use of eval() result in an error being generated. document.write('eval("12.34*10")='); document.write(eval("12.34*10")); Result-- eval("12.34*10")=123
  • 12. parseInt() function:  The parseInt() function is used to convert a string value to a integer.  parseInt() function returns the first integer contained in the string or 0 if the string does not begin with an integer. Example:  ParseInt(“123xyz”) returns 123 and parseInt(“xyz”) returns 0. document.write('parseInt("0*10")='); document.write(parseInt("0*10")); Result --parseInt("0*10")=0
  • 13. parsefloat() function:  parsefloat() function is similar to the parseInt() function.  It returns the first floating point number contained in the string or 0 when the string does not begin with a valid floating point number. Example:  parseFloat(“2.1e4xyz”) returns 21000 and parseFloat(“xyz”) returns 0. document.write('parseFloat("5.4321e6")='); document.write(parseFloat("5.4321e6")); parseFloat("5.4321e6")=5432100
  • 14. Convert String to integer Example  parseInt("4");  parseInt("5aaa");  parseInt("4.33333");  parseInt("aaa"); Result  4  5  4  NaN(Not a number)
  • 15. Converting float to integer Example  parseInt(5.133);  <script language="javascript"> var a = "334"; var b = 3; var c = parseInt(a)+b; var d = a+b; document.write("parseInt(a)+b = "+c); </script> Result  5  parseInt(a)+b = 337
  • 16. Converting String to Float Example  parseFloat("4.333");  parseFloat("5aaa");  parseFloat("aaa"); Result  4.333  5  NaN(Not a number)
  • 17. Converting Integer to String Example  var a = 3.22; a.toString();  var a = 5; a.toString();  <script language="javascript"> var a = 32; var b = 333; var c = a.toString()+b; document.write(" to String function "+c); </script> Result  3.22  5  32333