Error is not logged into the fCC Editor Console
See original GitHub issueDescribe the Issue
Hello everyone!
This code passes the tests, when it should not, because I used different names in the argument and the statement of the function:
.then(whateverString => {
document.getElementById('message').innerHTML = JSON.stringify(completelyDifferentString)
})
With this code, tests don’t fail, but the button Get Message
does nothing when pressed.
It should probably return an error message like "completelyDifferentString" is not defined
and should not pass the tests.
Affected Page
Your code
<script>
document.addEventListener('DOMContentLoaded',function(){
document.getElementById('getMessage').onclick= () => {
// Add your code below this line
fetch('/json/cats.json')
.then(response => response.json())
.then(whateverString => {
document.getElementById('message').innerHTML = JSON.stringify(completelyDifferentString)
})
// Add your code above this line
};
});
</script>
<style>
body {
text-align: center;
font-family: "Helvetica", sans-serif;
}
h1 {
font-size: 2em;
font-weight: bold;
}
.box {
border-radius: 5px;
background-color: #eee;
padding: 20px 5px;
}
button {
color: white;
background-color: #4791d0;
border-radius: 5px;
border: 1px solid #4791d0;
padding: 5px 10px 8px 10px;
}
button:hover {
background-color: #0F5897;
border: 1px solid #0F5897;
}
</style>
<h1>Cat Photo Finder</h1>
<p id="message" class="box">
The message will go here
</p>
<p>
<button id="getMessage">
Get Message
</button>
</p>
Expected behavior
Using different names for the argument in the second .then
should return an error:
.then(whateverString => {
document.getElementById('message').innerHTML = JSON.stringify(completelyDifferentString)
})
// error! "completelyDifferentString" is not defined
Tests should only pass if the names match, like so:
.then(whateverString => {
document.getElementById('message').innerHTML = JSON.stringify(whateverString)
})
Screenshots
No response
System
- Device: [PC]
- OS: [Manjaro 22.0.0]
- Browser: [Librewolf]
- Version: [98.0.2 (64 bit)]
Additional context
No response
Issue Analytics
- State:
- Created a year ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
`FCC` should be a constant variable declared with `const`
console.log(FCC, fact);. Showing this error when I “Run the Test” in E6 Javascript: FCC should be a constant variable declared with const ....
Read more >SiteMinder FCC Files
To avoid this situation, create and edit .fcc files that will be used in a UNIX environment on a ... Reason code that...
Read more >FCC Registration - Login
Welcome to the COmmission REgistration System (CORES). If you DO NOT have an FCC Username, please click the "REGISTER" button below to register...
Read more >ftp://ftp.fcc.gov/pub/Auctions/MDS/BTA/Auction_6/P...
Welcome to the FCC Auctions Remote Access System README. ... In no event shall the Commission, or any of its officers, employees or...
Read more >1006786 - Harassment and signal squelchening Description
yesterday while the tech was here onsite troubleshooting yet again; which by the way did not even log as a fault or service...
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
FWIW, the error is not shown on the fCC editor console but, surely, is logged on the browser console. Not sure if there is a way to fix this.
Needs additional investigation.
I agree with you that hardcoding a time limit is not good as we cant know how long it will take on the camper’s machine.
It wont work, for example this is completely valid code and will fail the above test:
fetch('/json/cats.json') .then(response => response.json()) .then(x => { console.log('I want to do something') return x }) .then(data => { document.getElementById('message').innerHTML = JSON.stringify(data); })