Page 1 of 1

3. Must be written in Javascript **Problem Description** You are given an array of numbers nums and a number n. At this

Posted: Fri Jul 01, 2022 5:39 am
by answerhappygod
3.
Must be written in Javascript
**Problem Description**
You are given an array of numbers nums and a number n.At this time, complete the solution, a function that returns thesmallest index among the same numbers as n in nums.
[Restrictions]
- If there is no number matching n in nums, it returns '-1'.
[Input format]
- nums is an array of length 100 or less consisting of integersbetween 1 and 100 and less than or equal to 100.
- n is an integer greater than or equal to 1 and less than orequal to 100.
[Output Format]
- Returns the smallest index within nums that matches n.
//
function solution(nums, n) {
var answer = 0;
return answer;
}
//