This was my solution to the problem:(这是我对问题的解决方案:)
var count = 5; while (count <= 50) { if ((count % 3 || count % 5) === 0) { console.log(count); } count++; }
This was my the instructors solution:(这是我的讲师解决方案:)
var count = 5; while (count <= 50) { if (count % 3 === 0 && count % 5 === 0) { console.log(count); } count++; }
Both of these solutions gave the proper answer, but I question why ||(这两个解决方案都给出了正确的答案,但我质疑为什么||。)
worked in my problem, rather than &&, I tried both.(解决了我的问题,而不是&&,我都尝试了。) && means both need to be true for it to properly run, right?(&&都需要正确运行才能正确运行,对吗?) So wouldn't that have been the proper use?(那不是正确的用法吗?)
ask by UndeadVandal translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…