JavaScript Lab 2 Quiz Prep - Full Conversation Summary
Part 1: True/False with Banglish Answers
1. JavaScript and Java are the same language. [Wrong] False - JavaScript ar Java completely alada.
2. JavaScript is case-sensitive. [Correct] True - lastName ar lastname alada variable.
3. Variables declared with `let` can be redeclared. [Wrong] False - abar declare kora jayna.
4. An external JavaScript file must have a `.js` extension. [Correct] True.
5. The `const` keyword allows reassignment. [Wrong] False - `const` reassign kora jayna.
6. Arrays can contain different data types. [Correct] True.
7. `this` in a method refers to the global object. [Wrong] False - refers to the owner object.
Part 2: More T/F and Fills
8. JavaScript can only be written inside <body>. [Wrong] False - head, body, ba external file e o possible.
9. Functions must always return a value. [Wrong] False - return optional.
10. Arrays use strings as index. [Wrong] False - array uses numbers.
11. Objects cannot contain functions. [Wrong] False - function as method possible.
12. Using let gives function scope. [Wrong] False - let is block scoped.
13. typeof [1,2,3] returns "object". [Correct] True - array is special kind of object.
Fill in the Blanks
1. Brendan Eich, 1995
2. <script> and </script>
3. innerHTML
4. push()
5. class
6. getElementById
7. for...in
8. function
9. ES6
10. this
11. querySelector (returns first match)
12. length (returns number of elements)
13. for...in (for object properties)
14. constructor()
Short Questions with Banglish Answers
- Difference between var, let, const
- this keyword usage in object
- innerHTML vs innerText vs textContent
- Function syntax, output methods
- DOM selection: getElementById, getElementsByClassName, querySelector
- Arrays, push, indexing
- class, constructor, inheritance, super()
False Statements Explained
- JavaScript and Java are NOT same
- let can't be redeclared
- const can't be reassigned
- this refers to object inside method
- JavaScript code can go in head/body/external file
- return optional in function
- arrays use numeric index
- objects can contain methods
- let is block scoped
Pro Tips Explained
1. let/const/var scopes and redeclaration rules
2. this refers to the calling object in method
3. Arrays use number index, objects use string keys
4. Output methods: alert, [Link], innerHTML
5. == vs === difference with type coercion