Question: 1) Given the following recursive function - what value used as an input (to 2 decimal places) will give the same value as output. f4(y)
1) Given the following recursive function - what value used as an input (to 2 decimal places) will give the same value as output. f4(y) = y Enter your answer with accuracy of 2 decimal places. function f4(x){ if (Math.abs(x*x - 4) < 0.01) return x; return f(x/2 + 1.5/x); }
2)What is the output of the following function with the input "( ( ) ) ( )" function g(s) { var a = s.split(""); var b = []; for (var i = 0; i < a.length; i++) { if (a[i] == '(') {b.push('*');} if (a[i] == ')') {if (b.length > 0) b.pop();} } return b.length; }
3)
What will be the output of the following code?
var abc = ["A", "B"];
var num = ["1", "2", "3"];
var newA = abc.concat(num);
document.getElementById("demo").innerHTML = abc;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
