Report Bug

QusWhich statement specify correct difference between var and let keywords in JavaScript? Qus कौन सा कथन जावास्क्रिप्ट में var और Let कीवर्ड के बीच सही अंतर निर्दिष्ट करता है?


A. var defines a variable while let defines a constant.
B. There is no such major difference between them
C. The value of variable declared with let cannot be changed
D. var define function scoped variable while let define block scoped variable


Solution
D. var define function scoped variable while let define block scoped variable



Explanation

var: Variables declared with var are function-scoped. This means they are only accessible within the function where they are declared. If a variable is declared outside any function, it becomes a global variable.

let: Variables declared with let are block-scoped. They are limited to the block, statement, or expression where they are declared. This includes loops, conditionals, and functions.

Latest Current Affairs 2025 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad