Does not accept logically equivalent answer
See original GitHub issueDescribe the Issue
When I write the loop as:
for (let i = 0; i < len; i++) {
console.log(firstFive[i]);
}
the response is evaluated to be correct. But similar approach and logically equivalent approach like:
for (let i = 0; i <= len-1; i++) {
// Only change code above this line
console.log(firstFive[i]);
}
is rejected.
In first loop, I converted<=
to<
to solve OBOE problem. In second loop, I changed the value i is being compared with like i <= len-1
both are acceptable approaches but the response is not accepted in case of 2nd approach.
Affected Page
Your code
function countToFive() {
let firstFive = "12345";
let len = firstFive.length;
// Only change code below this line
for (let i = 0; i <= len-1; i++) {
// Only change code above this line
console.log(firstFive[i]);
}
}
countToFive();
Expected behavior
Code should be considered as valid and must be accepted.
Screenshots
No response
System
Device: HP 255 g7
OS: Manjaro Linux
Browser: Mozilla Firefox
Version: 101.0.1
Additional context
No response
Issue Analytics
- State:
- Created a year ago
- Comments:15 (13 by maintainers)
Top Results From Across the Web
Logical Equivalences
The first method to show that two statements and p and q are equivalent is to build a truth table to to find...
Read more >2.2: Logically Equivalent Statements - Mathematics LibreTexts
Two expressions are logically equivalent provided that they have the same truth value for all possible combinations of truth values for all ...
Read more >Logical Form And Logical Equivalence
The negation of a conjunction (logical AND) of 2 statements is logically equivalent to the disjunction (logical OR) of each statement's negation. That...
Read more >Why are the following not logically equivalent?
With that interpretation, for all x the antecedent is true because for any x in the domain {0,1} either P is true or...
Read more >Logical Equivalence (Explained w/ 13+ Examples!)
This means we can also say that If Ryan does not take Allison to dinner, then he did not get a pay raise...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Personally, I don’t think we need to add every single possible way to accomplish this task. The current regex handles the majority of learner solutions. This extra case should handle the overwhelming majority of learner solutions. We can add more if they become necessary.
File with the code.
I was going to suggest we reword the instructions, but I think it would be fine to account for both of these possible variations. Here’s a regex I made quick:
i\s*<\s*len\s*;|i\s*<=\s*len\s*-\s*1\s*;