Kit Library / Computer Science / Programming Fundamentals

⚡ Topic Learning Kit

Java script

Gujarati 22 leveled MCQs 17 flashcards Free

Shared by a Veda learner · Generated with Veda AI

Veda Bites

The whole idea, one bite at a time

Veda Bites are swipeable micro-lessons — each one teaches exactly one idea. The bites below come from this kit — swipe through them in the app.

💡 Key Idea

JavaScript શું છે?

વેબની ભાષા, શીખો મૂળભૂત.

JavaScript (JS) એ high-level, interpreted programming language છે જેનો ઉપયોગ મુખ્યત્વે web pagesને *interactive* બનાવવા માટે થાય છે. તે HTML અને CSS સાથે મળીને કામ કરે છે. JS browserમાં ચાલે છે અને userના actionsને respond કરી શકે છે.

↳ JavaScript એ વેબ પરની સૌથી મહત્વપૂર્ણ scripting language છે.

📖 Definition

Variables: let, const, var

ડેટા સ્ટોર કરવાના ત્રણ રસ્તા.

JavaScriptમાં ડેટા સ્ટોર કરવા માટે variables વપરાય છે. ત્રણ મુખ્ય keywords છે: `let`, `const`, અને `var`. `let` block-scoped છે અને તેની value બદલી શકાય છે. `const` પણ block-scoped છે પણ તેની value reassign કરી શકાતી નથી. `var` function-scoped છે અને જૂની પદ્ધતિ છે.

↳ મોટાભાગે `let` અને `const` વાપરો, `var` ટાળો.

⭐ Important Fact

Data Types: Primitive vs Reference

ડેટાના પ્રકારો સમજો.

JavaScriptમાં primitive data types (String, Number, Boolean, null, undefined, Symbol, BigInt) અને reference data types (Object, Array, Function) હોય છે. Primitives by value સ્ટોર થાય છે, જ્યારે references by reference સ્ટોર થાય છે.

↳ Primitives immutable છે, objects mutable છે.

✏️ Example

typeof Operator

ડેટા type કેવી રીતે ચેક કરવો?

`typeof` operator કોઈપણ valueનો data type શોધવા માટે વપરાય છે. તે string return કરે છે.

↳ `typeof` data type ઓળખવા માટે ઉપયોગી છે, પણ `null` માટે સાવધાન રહો.

➗ Formula

Type Coercion

JavaScript આપોઆપ type બદલે છે.

Type coercion એટલે JavaScript દ્વારા એક data typeને બીજામાં આપોઆપ રૂપાંતરિત કરવું. ઉદાહરણ: `'5' - 3` → `2` (string numberમાં convert થાય છે).

↳ Type coercion ઉપયોગી છે પણ અણધાર્યા પરિણામો લાવી શકે છે.

⚠️ Common Mistake

== vs ===

સમાનતા ચેક કરવાની સાચી રીત.

`==` (loose equality) type coercion કરે છે, જ્યારે `===` (strict equality) type અને value બંને ચેક કરે છે. હંમેશા `===` વાપરવાની ભલામણ કરવામાં આવે છે.

↳ ભૂલો ટાળવા માટે `===` વાપરો.

💡 Key Idea

Functions: Declaration vs Expression

કોડને ફરીથી વાપરો, function બનાવો.

Functions JavaScriptમાં codeના reusable blocks છે. Function declaration: `function name() {}` hoisted થાય છે. Function expression: `const name = function() {}` hoisted થતું નથી. Arrow functions: `() => {}` concise syntax આપે છે.

↳ Arrow functions modern JavaScriptમાં પ્રિય છે.

⚙️ Process

Scope: Global vs Local

Variable ક્યાં ઉપલબ્ધ છે?

Scope એટલે variableની accessibilità. Global scopeમાં variable બધી જગ્યાએ access થાય છે. Local scope (function/block scope)માં variable ફક્ત તે blockની અંદર જ ઉપલબ્ધ છે. `let` અને `const` block-scoped છે.

↳ Variableની scope સમજવી bugs ટાળવા માટે જરૂરી છે.

⚖️ Comparison

null vs undefined

બંને 'કંઈ નહીં' દર્શાવે છે, પણ અલગ.

↳ `null` intentional છે, `undefined` unintentional.

✅ Best Practice

Naming Conventions

સારા નામ, સારો કોડ.

↳ Consistent naming code readability વધારે છે.

🎯 Exam Tip

Hoisting સમજો

Declaration ઉપર ખસે છે.

Hoisting એ JavaScriptની એક વર્તણૂક છે જેમાં variable અને function declarations તેમના scopeની ટોચ પર 'ખસેડાય' છે. ફક્ત declarations hoist થાય છે, initializations નહીં. `let` અને `const` hoisted છે પણ temporal dead zoneમાં હોય છે.

↳ Hoisting સમજવાથી અણધાર્યા errors ટાળી શકાય છે.

🧠 Memory Trick

Primitives યાદ રાખવાની ટ્રિક

7 primitives: S N B N U S B.

JavaScriptમાં 7 primitive types છે: String, Number, Boolean, Null, Undefined, Symbol, BigInt. ટ્રિક: "SNBNUSB".

↳ આ ટ્રિક primitives યાદ રાખવામાં મદદ કરશે.

🌍 Real World

Real-World: Form Validation

JavaScript વેબ ફોર્મ ચેક કરે છે.

વેબસાઇટ્સ પર form submit કરતા પહેલા JavaScript દ્વારા input ચેક કરવામાં આવે છે. ઉદાહરણ: email format સાચો છે કે નહીં, password length ઓછો છે કે નહીં. આ user experience સુધારે છે અને server પરનો ભાર ઘટાડે છે.

↳ JavaScript client-side validation માટે અનિવાર્ય છે.

🛠️ Application

Template Literals

Stringsને સરળ બનાવો.

Template literals backticks (`` ` ``) દ્વારા બનાવાય છે. તેમાં `${expression}` દ્વારા variables અને expressions embed કરી શકાય છે. Multiline strings પણ સરળતાથી બનાવી શકાય છે.

↳ Template literals string manipulationને વધુ સરળ બનાવે છે.

❓ Did You Know

JavaScriptનો જન્મ

10 દિવસમાં બનાવાયેલી ભાષા.

JavaScript 1995માં Brendan Eich દ્વારા માત્ર 10 દિવસમાં બનાવવામાં આવી હતી. શરૂઆતમાં તેનું નામ Mocha હતું, પછી LiveScript, અને અંતે JavaScript. આજે તે વિશ્વની સૌથી લોકપ્રિય programming languagesમાંની એક છે.

↳ JavaScriptનો ઇતિહાસ રસપ્રદ અને પ્રેરણાદાયક છે.

🚫 Warning

Semicolons: Optional પણ સાવધાન

ભૂલો ટાળવા semicolon વાપરો.

JavaScriptમાં semicolons (;) optional છે, પણ ક્યારેક તેને ન નાખવાથી Automatic Semicolon Insertion (ASI) અણધાર્યા પરિણામો લાવી શકે છે. ઉદાહરણ: return પછી નવી લાઇન પર value લખવાથી undefined return થાય છે.

↳ ભૂલો ટાળવા માટે semicolons નાખવાની આદત બનાવો.

Smart notes

What you'll study, topic by topic

1

JavaScript Fundamentals: Variables, Data Types, and Functions

8 min

JavaScript એ વેબ પરની મુખ્ય scripting language છે જે variables, data types, અને functions દ્વારા interactive web pages બનાવવામાં મદદ કરે છે. આ ટોપિકમાં let/const/var, primitive vs reference types, type coercion, scope, h…

  • JavaScript high-level, interpreted language છે, મુખ્યત્વે client-side વપરાય છે.
  • Variables માટે let (mutable) અને const (immutable) વાપરવાની ભલામણ છે.
  • Primitive types (String, Number, Boolean, etc.) immutable છે, reference types (Object, Array) mutable છે.

Full explanation, worked examples & memory tricks in the app

Leveled MCQ practice

Try the smart MCQs from this kit

All 22 questions, laddered from warm-up to topper-level, each with its answer and the reasoning behind it.

Warm-up · 9 questions

Q1. JavaScript માં variable declare કરવા માટે નીચેનામાંથી કયો keyword વપરાય છે?

Beginner
A int
B float
C var
D string

Answers and explanations are in the Veda app.

Q2. JavaScript function ને define કરવા માટે નીચેનામાંથી કયો syntax સાચો છે?

Beginner
A func myFunction() {}
B function: myFunction() {}
C function myFunction() {}
D def myFunction() {}

Answers and explanations are in the Veda app.

Q3. JavaScript માં array માં પ્રથમ element નો index શું છે?

Beginner
A 1
B 0
C -1
D undefined

Answers and explanations are in the Veda app.

Q4. JavaScript function માં parameters કેવી રીતે pass કરવામાં આવે છે?

Beginner
A function name પછી angle brackets માં
B function name પછી curly braces માં
C function name પછી parentheses માં
D function name પછી square brackets માં

Answers and explanations are in the Veda app.

Q5. JavaScript માં 'boolean' ડેટા ટાઈપ કેટલી values લઈ શકે છે?

Beginner
A ત્રણ: true, false, અને null
B બે: true અને false
C ચાર: true, false, 0, અને 1
D એક: true

Answers and explanations are in the Veda app.

Q6. JavaScript માં 'undefined' શું દર્શાવે છે?

Beginner
A variable declare જ નથી થયો
B variable declare થયો પણ value assign નથી
C variable ની value 0 છે
D variable ની value null છે

Answers and explanations are in the Veda app.

Q7. JavaScript માં 'string' ડેટા ટાઈપ માટે કયા quotes વાપરી શકાય છે?

Beginner
A માત્ર single quotes
B માત્ર backticks
C double, single, અને backticks
D માત્ર double quotes

Answers and explanations are in the Veda app.

Q8. JavaScript માં 'var' keyword વડે declare કરેલ variable ને reassign કરી શકાય છે.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q9. JavaScript માં 'number' ડેટા ટાઈપ integer અને float બંનેને આવરી લે છે.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Building up · 8 questions

Q10. JavaScript માં 'null' ડેટા ટાઈપ શું દર્શાવે છે?

Intermediate
A એક intentional absence of any object value
B એક undefined value
C એક boolean false
D એક ખાલી string

Answers and explanations are in the Veda app.

Q11. JavaScript માં '===' ઓપરેટર શું કરે છે?

Intermediate
A value અને data type બંનેની સરખામણી કરે છે
B માત્ર value ની સરખામણી કરે છે
C માત્ર data type ની સરખામણી કરે છે
D value ને string માં convert કરીને સરખામણી કરે છે

Answers and explanations are in the Veda app.

Q12. JavaScript માં 'typeof' ઓપરેટર શું રિટર્ન કરે છે?

Intermediate
A variable ની length
B variable નું name
C variable નો data type string તરીકે
D variable ની value

Answers and explanations are in the Veda app.

Q13. JavaScript માં 'NaN' શું દર્શાવે છે?

Intermediate
A New Array Number
B Not a Number
C Null and Null
D Negative Number

Answers and explanations are in the Veda app.

Q14. JavaScript માં 'const' keyword વડે declare કરેલ variable ની value બદલી શકાય છે?

Intermediate
A હા, પરંતુ માત્ર function ની અંદર
B હા, કોઈપણ સમયે
C ના, પરંતુ તેનો data type બદલી શકાય છે
D ના, તે constant છે અને reassign કરી શકાતી નથી

Answers and explanations are in the Veda app.

Q15. JavaScript function માં 'return' statement વગર function શું રિટર્ન કરે છે?

Intermediate
A false
B 0
C null
D undefined

Answers and explanations are in the Veda app.

Q16. JavaScript function માં 'return' statement પછી કોઈ code execute થતો નથી.

Intermediate
A True
B False

Answers and explanations are in the Veda app.

Q17. JavaScript માં 'let' keyword વડે declare કરેલ variable ને function ની બહારથી access કરી શકાય છે.

Intermediate
A True
B False

Answers and explanations are in the Veda app.

Topper level · 5 questions

Q18. JavaScript માં 'let' અને 'var' વચ્ચેનો મુખ્ય તફાવત શું છે?

Advanced
A બંને સરખા છે
B 'let' block-scoped છે, 'var' function-scoped છે
C 'let' function-scoped છે, 'var' block-scoped છે
D 'let' global-scoped છે, 'var' local-scoped છે

Answers and explanations are in the Veda app.

Q19. JavaScript માં 'function expression' શું છે?

Advanced
A function ને parameter તરીકે pass કરવું
B function ને name આપવું
C function ને return કરવું
D function ને variable માં assign કરવું

Answers and explanations are in the Veda app.

Q20. JavaScript માં 'typeof null' શું રિટર્ન કરે છે?

Advanced
A 'boolean'
B 'undefined'
C 'object'
D 'null'

Answers and explanations are in the Veda app.

Q21. JavaScript માં 'NaN' એ 'typeof' ઓપરેટર વડે 'number' રિટર્ન કરે છે.

Advanced
A True
B False

Answers and explanations are in the Veda app.

Q22. JavaScript માં 'function declaration' ને hoisting થાય છે.

Advanced
A True
B False

Answers and explanations are in the Veda app.

Flashcards

Tap a card to flip it

17 flashcards in this kit — the app reviews them with spaced repetition so the right card returns on the right day.

Study it properly — free, in the app

The full Veda Bites deck, complete notes, spaced-repetition flashcards, leveled MCQs, tests and games for this kit — plus Daily Facts and the Arena, every day.