My javascript encountered a runtime error
Whenever i program with javascript in khanacademy's programming environment, it says "
Whenever i program with javascript in khanacademy's programming environment, it says "
Hi there!
Would you be able to post the full version of your code so I can take a closer look at the issue? Based on the error message, it seems like it could be an issue with the code itself and not the editor.
Thanks!
Hi! Here is the code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Challenge: Style guide</title>
</head>
<body>
<h1>Style guide</h1>
<p>The hottest color to wear right now is:
<span id="trendy-color">?</span>
</p>
<p>This is the trendy way to sign an autograph:
<span id="trendy-handwriting">?</span>
</p>
<p>This is the trendy way to frame photographs:
<br>
<img id="trendy-frame" src="https://www.kasandbox.org/programming-images/avatars/mr-pink.png" alt="Cool avatar">
</p>
<script>
var colorEl = document.getElementById("trendy-color");
var handEl = document.getElementById("trendy-handwriting");
var frameEl = document.getElementById("trendy-frame");
colorEL.style.color = "orange";
</script>
</body>
</html>
Ah yes, it looks like the issue is coming from this line:
colorEL.style.color = "orange";
JavaScript is a case-sensitive programming language, so "colorEL" (with a capital L) is not the same as "colorEl" (with a lowercase L). Since it's defined above with a lowercase letter, you must refer to the variable using the lowercase version in order for the code to work properly.
OMG!!! Thank you so much.
Just gonna add that pretty much every single programming language ever created is case-sensitive. That is because a lowercase letter and an uppercase letter for example a and A are completely different characters to the computer. They are represented different number values.
Влезте в услугата, за да оставите коментар.