Podcast
Questions and Answers
Study Notes
Variables
- A variable is a container that holds a value.
- In JavaScript, variables are declared using the
let
,const
, orvar
keywords. -
let
andconst
are block-scoped, whilevar
is function-scoped. - Variables can be reassigned, except for those declared with
const
. - Variables can be initialized with a value or left undefined.
Data Types
-
Primitive Data Types:
- Number:
42
or3.14
- String:
"hello"
or'hello'
- Boolean:
true
orfalse
- Null:
null
- Undefined:
undefined
- Number:
-
Complex Data Types:
- Object:
{ key: value, ... }
- Array:
[ element, ... ]
- Function:
function() { ... }
- Object:
Functions
- A function is a block of code that can be executed multiple times.
- Functions can take arguments and return values.
- Functions can be declared using the
function
keyword or as an arrow function. - Functions can be assigned to variables or passed as arguments to other functions.
Conditional Statements
-
If Statement:
-
if (condition) { code }
- Executes code if condition is true
-
-
If-Else Statement:
-
if (condition) { code } else { code }
- Executes code if condition is true, otherwise executes else code
-
-
Switch Statement:
-
switch (expression) { case value: code; break; ... }
- Executes code based on the value of the expression
-
Loops
-
For Loop:
-
for (init; condition; increment) { code }
- Executes code repeatedly while condition is true
-
-
While Loop:
-
while (condition) { code }
- Executes code repeatedly while condition is true
-
-
Do-While Loop:
-
do { code } while (condition)
- Executes code at least once, then repeats while condition is true
-
-
For-Of Loop:
-
for (variable of iterable) { code }
- Executes code for each element in the iterable
-
-
For-In Loop:
-
for (variable in object) { code }
- Executes code for each property in the object
-
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Description
জাভাস্ক্রিপ্টে ভেরিয়েবল এবং ডেটা টাইপ সম্পর্কিত প্রশ্ন। এখানে ভেরিয়েবল ডিক্লারেশন, স্কোপ, ডেটা টাইপ সম্পর্কিত বিষয় নিয়ে আলোচনা করা হয়েছে。