Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Purpose The purpose of this assignment is to practice writing function in JS . Tasks Create a function called sumDigits ( n ) Skeleton function
Purpose
The purpose of this assignment is to practice writing function in JS
Tasks
Create a function called sumDigitsn
Skeleton
function sumDigitn
return ;
Test cases
sumDigits returns ;
sumDigits returns ;
sumDigits returns ;
Hint
There are several approaches to solving this problem.
One approach is to use modulo and integer division operators.
Use the operator to extract digits, and the operator to remove the extracted digit.
For instance, to extract from use
To remove from use
Use a loop to repeatedly extract and remove the digit until all the digits
are extracted.
Acceptance Criteria
No syntax error
The program should pass three test cases
Completion
Submit source code with the name lastnamefirstnameassignmentjs so that your instructor can run them successfully in hisher VSC
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started