dodo-logan / hyf-javascript-1 Goto Github PK
View Code? Open in Web Editor NEWjavascript 1 homework
javascript 1 homework
It seems Jim has already been here.
But for some other things:-
ARRAY.JS - just looking at the last lines, you may want to define the last variable "a" as something else, or you may not remember the code some time down the line.
Also a good idea to watch the spacing, +a
should be + a
.
FUNCTION.JS -
// step11 console.log("if I added a new vehicle to the list ,the code will change.");
I think the idea is that if you added something in here, it's supposed to integrate the additional object within the array.
I think though that on a whole you probably did better than me here.
STRING.JS -looks fine.
J.
Hi Kaze, thanks for posting your homework. Here is my feedback.
.eslintrc.json
as explained in VSCode Tips - Using VSCode for your homework. I didn't find this file in you repo and I advise you to create as per the instructions.exercise 1
exercise 2
I'm
? Again, pay attention to detail: the I
in I'm
should be a capital.exercise 3
"editor.formatOnType": true,
"editor.formatOnPaste": true
You can manually reformat your JavaScript files by using the Format Document keyboard shortcut as explained in VSCode Tips - Some useful short-cut commands. Try it on your files and see what happens!
For punctuation symbols such as ,
, ;
and :
the rule is there should no space before the symbol and one space after the symbol:
... x will be: undefined!');
^space here
exercise 4
exercise 8
typeof
an array is actually 'object'
, i.e. an array is a special type of object.Your code:
if (typeof l === typeof country, typeof country === age, typeof age === typeof programmer) {
...
}
is actually equivalent to:
if (typeof age === typeof programmer) {
...
}
The comma separating the conditions in your if
statement is interpreted here as a 'comma operator'. See this article: MDN - Comma operator. If you want to test these various conditions, it is best to create one if
statement per condition, like this:
if (typeof l === typeof country) {
console.log('SAME TYPE')
}
else {
console.log('NOT SAME TYPE');
}
if (typeof country === age) {
console.log('SAME TYPE')
}
else {
console.log('NOT SAME TYPE');
}
if (typeof age === typeof programmer) {
console.log('SAME TYPE')
}
else {
console.log('NOT SAME TYPE');
}
exercise 9:
remainer
-> remainder
. Did you install the Spell Checker extension in VSCode? See the VSCode Tips.exercise 10
As you can see, most of my comments are about formatting and spelling. Check the VSCode Tips to remedy the issues. Functionality-wise you did very well. Congrats!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.