Set value to true if the array arr contains a 7, and to false otherwise.

javascript programming
exercise: arrays 01

x
    document.write("<td><pre>"+str(testAA[i][nArgs])+"</pre></td>");
 
1
<html>
2
<script>
3
4
function hasSeven(arr) {
5
  var value;
6
  // ADD CODE UNDER THIS LINE
7
  
8
  return value;
9
}
10
11
var testAA = [
12
  [[1],false],
13
  [[7],true],
14
  [[1,2,3,8],false],
15
  [[200,4,7], true]
16
];
17
18
function cloneTree(obj) {
19
  if (obj === null)
20
    return null;
21
  if (typeof obj !== "object")
22
    return obj;
23
  var newobj = {};
24
  for (var prop in obj) {
25
    newobj[prop] = cloneTree(obj[prop]);
26
  }
27
  return newobj;
28
}
29
30
var argAAS = [];
31
for (var i=0;i<testAA.length;i++) {
32
  argAAS.push( [] );
33
  for (var j=0;j<testAA[i].length-1;j++) {
34
    argAAS[i].push( str(testAA[i][j]) );
35
  }
36
}