Hello I am starting this trek of self learning code. Currently on Youtube, I am watching Javascript: Understanding the Weird Parts - The First 3.5 Hours. The video is 8 years old. I am following the examples of code on Bracket.io step by step and I am receiving an immense amount of errors from JSLint and ESLint. I believe this could be a version compatibility error, am I correct? How do I correct this? As I am learning Java, will the version of the code affect the functionality of the code itself? Is each version different and therefore must I have to learn each variation of versions?
This is the code:
var a = 'hello world!';
function b() {
console.log('Called b!');
}
b();
console.log(a);
These are the errors:
8 Problems
JSLint (4)3
Unexpected '(space)'.function b() {4
Missing 'use strict' statement.console.log('Called b!');4
'console' was used before it was defined.console.log('Called b!');8
'console' was used before it was defined.console.log(a); ESLint (4)4
ERROR: Unexpected console statement. [no-console]console.log('Called b!');4
ERROR: 'console' is not defined. [no-undef]console.log('Called b!');8
ERROR: Unexpected console statement. [no-console]console.log(a);8
ERROR: 'console' is not defined. [no-undef]console.log(a);
I expected to declare variable a as 'hello world'. Then declare function b() as 'Called b!' and print that into the console. When I ran the program on google chrome and opened up the console code, printed the lexical code by declaring 'window' and looking under the hood. The code in fact was not stored in the thread of execution. I attempted to declare no quirks mode with this code at the beginning:
<!DOCTYPE html>
<html lang="en">
and these were the problems attached to the code. Any ideas what is going on?
2+ Problems
×
JSLint (2)10
Unexpected '<!'.''10
Stopping. (50% scanned).'' ESLint (1)1
ERROR: Parsing error: Unexpected token <
Note that Java and Javascript are to completely different, incompatible languages (So make sure to setup "Javascript" and not "Java" in your Editor).
The support of Javascript (ECMAScript) versions is usually not a problem if you are using current Browsers. Only a few features might not be supported, which you will probably not deal with at this state.
It should work to store this code in a file called
index.html, and open that file in a browser: