0% found this document useful (0 votes)
2 views11 pages

JavaScript Strings Logic Presentation2

The document provides an overview of string operations in JavaScript, including declaration, manipulation, searching, and slicing. It also compares JavaScript strings with Python strings and discusses variable declarations with let, var, and const, along with scope differences. Additionally, it covers escape sequences and boolean logic in JavaScript.

Uploaded by

arupghosh123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views11 pages

JavaScript Strings Logic Presentation2

The document provides an overview of string operations in JavaScript, including declaration, manipulation, searching, and slicing. It also compares JavaScript strings with Python strings and discusses variable declarations with let, var, and const, along with scope differences. Additionally, it covers escape sequences and boolean logic in JavaScript.

Uploaded by

arupghosh123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

JavaScript Strings, Variables & Logic

String Operations in JavaScript

• Declaring strings: let firstName = "Alice";


• Template literals: `Hello ${name}`
String Manipulations

• .length, .toUpperCase(), .toLowerCase()


• Character access with str[0]
String Searching & Slicing

• .indexOf(), .includes()
• .slice(), .substring()
Replacing and Splitting

• replace, replaceAll with regex


• split(" "), trim(), repeat()
JavaScript vs Python – Strings
Concept JavaScript Python
Interpolation `Hi ${name}` f"Hi {name}"
Multiline Backticks `` Triple quotes
Repetition "Ha!".repeat(3) "Ha" * 3
let vs var vs const

• let: block scoped, changeable


• var: function scoped, redeclarable
• const: block scoped, constant
Scope Differences

• Block vs function scope


• Example with var x = "outside" vs let y =
"outside"
Escape Sequences & Booleans

• \n, \" , \\, \t explained


• Boolean logic: &&, ||, !
Boolean Example

• isLoggedIn, isAdmin
• Expressions: canEdit, canView, isGuest
Summary

• Strong string handling in JS


• Control with logical and scope operations

You might also like