[Fix] Corrected bug found in Shopping List challenge (#35017)
* fix: corrected bug found in issue #16044 * fix: account for empty strings Co-Authored-By: RandellDawson <5313213+RandellDawson@users.noreply.github.com> * fix: corrected wrong logicpull/35307/head
parent
5b73ed54e2
commit
b83ab53047
|
@ -64,14 +64,14 @@ var hasNumber = false;
|
|||
if(myList.length > 0) {
|
||||
hasString = true;
|
||||
hasNumber = true;
|
||||
myList.forEach(function(elem) {
|
||||
if(typeof elem[0] !== 'string') {
|
||||
for (var elem of myList) {
|
||||
if(!elem || !elem[0] || typeof elem[0] !== 'string') {
|
||||
hasString = false;
|
||||
}
|
||||
if(typeof elem[1] !== 'number') {
|
||||
if(!elem || typeof elem[1] !== 'number') {
|
||||
hasNumber = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
count = myList.length;
|
||||
return JSON.stringify(myList);
|
||||
|
|
Loading…
Reference in New Issue