Beginner JavaScript found some beginner mistakes, summarized here.
1. Use semicolons to
end a line of statements without adding ";", but you must add ";" between two statements on the same line.
2. Two ways to call object keys
var phone={zone;'010',number;'1234567'}
var phone-number=phone['zone']+phone.number;
console.log(phone-number);
Output: 0101234567
3.x==y;//Is the comparison value equal
x===y;//Is the comparison value and type equal
4.The difference between let and var is
mainly reflected in
the variables defined by different vars in the scope Global variables or function variables
The variables defined by let are block-level variables or local variables
5. The method of adding a key-value pair to the hash table table name
[key]=value =ages[key] 7. Find the value object name of a key in the object. Key 8. Jump statement break Jump out of the current loop continue to end this loop 9. The difference between while and do-while while first judges the condition, and then executes the statement
do-while executes the statement first, and then judges the condition
10. Any type added to a string will be converted to a string type
Summary of mistakes for beginners in js
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=326800815&siteId=291194637
Recommended
Ranking