Fix shopping list tests.
parent
97cdc71772
commit
5f8406d350
|
@ -1744,23 +1744,30 @@
|
|||
],
|
||||
"tail": [
|
||||
"var count = 0;",
|
||||
"var isArray = true;",
|
||||
"var hasString = true;",
|
||||
"var hasNumber = true;",
|
||||
"var isArray = false;",
|
||||
"var hasString = false;",
|
||||
"var hasNumber = false;",
|
||||
"(function(list){",
|
||||
" if(Array.isArray(myList)) {",
|
||||
" myList.forEach(function(elem) {",
|
||||
" if(typeof elem[0] !== 'string') {",
|
||||
" hasString = false;",
|
||||
" }",
|
||||
" if(typeof elem[1] !== 'number') {",
|
||||
" hasNumber = false;",
|
||||
" }",
|
||||
" });",
|
||||
" isArray = true;",
|
||||
" if(myList.length > 0) {",
|
||||
" hasString = true;",
|
||||
" hasNumber = true;",
|
||||
" myList.forEach(function(elem) {",
|
||||
" if(typeof elem[0] !== 'string') {",
|
||||
" hasString = false;",
|
||||
" }",
|
||||
" if(typeof elem[1] !== 'number') {",
|
||||
" hasNumber = false;",
|
||||
" }",
|
||||
" });",
|
||||
" }",
|
||||
" count = myList.length;",
|
||||
" return JSON.stringify(myList);",
|
||||
" } else {",
|
||||
" isArray = false;",
|
||||
" hasString = false;",
|
||||
" hasNumber = false;",
|
||||
" return \"myList is not an array\";",
|
||||
" }",
|
||||
"",
|
||||
|
|
Loading…
Reference in New Issue