1. switchSelect one of multiple code blocks to be executed switch(e) { case 1: //e is 1, execute break here; case 2: //e is 2, execute break here; default: // None of them meet the requirements to execute here} Notice:
2. While LoopIf the following condition is not met, the loop will continue until the parameter "i" is not less than 10 while (i < 10) { text += "The number is" + i; i++; } 3. Do/While LoopThis is similar to the above, but it will be executed at least once, because it is executed first and then judged. do { text += "The number is " + i; i++; } while (i < 10);
3. Convert string to numberMany students will encounter the problem of converting strings to numbers, but they can't remember the words to convert, or they are too lazy to write them. In this case, just add a + sign in front of the variable. Like this: let a = "12" // This is a string console.log(+a) // Now it is converted to the number 12 This concludes this article about common JavaScript statements for loops, judgments, and string to number conversion. For more related content on common JavaScript statements, please search previous articles on 123WORDPRESS.COM or continue browsing the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
>>: Solution for Baidu site search not supporting https (tested)
An index is a sorted data structure! The fields t...
The pop-up has nothing to do with whether your cur...
Requirement: Celery is introduced in Django. When...
This article example shares the specific code of ...
This article takes the connection error ECONNREFU...
When we write pages, we sometimes find that the C...
What is nGrinder? nGrinder is a platform for stre...
<br />The website access speed can directly ...
/******************** * Virtual File System VFS *...
Table of contents Development Environment Game en...
Recently, I encountered many problems when deploy...
We all know that after the MySQL database is inst...
This may be an issue that is easily overlooked. F...
<br />Original text: http://research.microso...
•There are many selectors in CSS. What will happe...