- Executors
-
Learn
Learn Python Runnable examples, NumPy, pandas, and more Learn AI / Machine LearningNeural networks, ML and LLMs from scratch Learn C & C++ Pointers, memory, STL, and modern C++ Learn C#C# basics, OOP, LINQ, async, and .NET exercises Learn MatplotlibLine, bar, scatter and pie charts with live visualizers Learn RustOwnership, traits, error handling, and threads Learn GoSlices, interfaces, goroutines, and channels Python Algorithms Search, sorting, recursion, and visualizers O(n) C & C++ Algorithms Compare algorithms implemented in C and C++ Coding for Kids Learn to code by playing!
- QuizzesNew
- ChallengesNew
- For TeachersNew
- Updates
- Buy me a coffee
JavaScript Getters, Setters & static Quiz
This JavaScript quiz focuses on accessors and static members. You will predict what getters return, what happens when you assign to a getter-only property, how static members are shared and inherited, and which getters JSON.stringify sees.
Sample question
Question 1 of 10Temp defines get fahrenheit() { ... }. How do you read the value for const t = new Temp(100)?
Show the answer
C. t.fahrenheit A getter is read like a normal property, with no parentheses, and JavaScript calls the function for you. t.fahrenheit() would try to call the returned number, and Temp.fahrenheit looks on the class, not the instance.
What this quiz covers
- Reading a
getproperty without parentheses - Validating input in a
setaccessor - Getter-only properties in sloppy and strict mode
staticfields, methods andthisinside them- The infinite recursion trap in setters
Questions people ask
Do I need an account?
No. Anyone can play. Sign in to keep your XP, streak, badges and history.
Can I retake it?
Yes. Your best score is kept, and the questions and answers are shuffled each time.