

JavaScript Event Handling and Evaluation
Flashcard
•
Computers
•
8th Grade
•
Easy
Geetanjali Mohanty
Used 1+ times
FREE Resource
Student preview

7 questions
Show all answers
1.
FLASHCARD QUESTION
Front
What does the line 'let scrn = document.getElementById("screen");' do?
Back
It selects the HTML element with the id 'screen' and assigns it to the variable 'scrn'.
2.
FLASHCARD QUESTION
Front
What is the purpose of 'currentvalue' in the code?
Back
It stores the current value being displayed or calculated.
3.
FLASHCARD QUESTION
Front
What does 'document.querySelectorAll("td").forEach(cell => {' do?
Back
It selects all 'td' elements in the document and iterates over them, allowing for event listeners to be added to each cell.
4.
FLASHCARD QUESTION
Front
What happens when a cell with the text 'C' is clicked?
Back
The 'currentvalue' is reset to an empty string.
5.
FLASHCARD QUESTION
Front
What does the line 'currentvalue = eval(currentvalue).toString();' do?
Back
It evaluates the expression stored in 'currentvalue' and converts the result to a string.
6.
FLASHCARD QUESTION
Front
What is the effect of clicking a cell that contains a number or operator?
Back
The clicked value is appended to 'currentvalue'.
7.
FLASHCARD QUESTION
Front
What does 'scrn.textContent = currentvalue;' accomplish?
Back
It updates the text content of the 'screen' element with the current value.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Microsoft
or continue with
%20(1).png)
Apple
Others
Already have an account?