let status = true;
while (status) {
}
console.log ("not executed here");
let status = true;
while (status) {
}
console.log ("not executed here");
while (true) is of course an endless cycle. There is no reason why
while sends a true into it, which is equivalent to being in a loop all the time. There is no end
Xiong du, you status
are all assigned true
values
No wonder the endless cycle
your code execution flow
let status = true;
while (status) { // true {} false status true
}
...
unless there is a statement in your while
loop that modifies the status
variable value to the false
state, it must be an endless loop.
first of all, almost all the program control keywords in the programming language, including judgments, loops, and so on, are actually derived from if; in other words, if the language allows, they can all be written as if.. The form of.
second, come back to the question. Then while can be transformed into:
Label:
If (xxx) {
dosomething;
Goto Label;
}
this form. Of course, this is not javascript, because it removes goto and retains only label, when it is designed, so you just have to be able to understand what it means. So we know that if (true)
is actually a "common" logical statement without judgment, so at this point, this paragraph actually becomes:
Label:
dosomething;
Goto Label;
has no control, and the program is constantly shuffling back and forth between performing actions and jumping to label paragraphs, that is, an endless loop.
let status = true;
while (status) {
}
you don't change the value of status in while, so it's always true, and goes all the way here, forming an endless loop
.the backend returns the image address, and after stitching the string, it is displayed on the page The actual address displayed by the src of img is http: localhost:port + picture address which god knows how to solve this problem img src img src...
as shown in the figure, the development environment is configured with forwarding but after packaging, there is no whether the code in the production environment can be forwarded . now the URL in the production environment defaults to the access ...
vuescript JS, mounted js script js ,, so, to fix this BUG, you must make sure that the external js is loaded, but I don t know how to make sure that the JS is loaded. May I ask the gods how to do this? ...
excuse me, when can I use loadChildren to route? On the Internet, it is said that the loading sub-module, in the project, what is the sub-module ah. How is this "sub-module " design specification defined? do you have any examples for reference.? ...
function fun(a,b){ console.log(`${a},${b}`) } fun(123,456); 123a456b123456 is there a parameter passing method in js similar to fun (baked 456 ...
recently, I have been trying to develop my own wheels with native js. The first project is paging, but because I am not familiar with the encapsulation mode of native js plug-ins, I would like to ask you to see if my writing rules are not standard? There...
does webpack reverse engineering have any friends who know about it? my source file can t be found. after webpack is packaged, how can I get the sourcemap file back to the source file? ...
this is your own. When you move, the direction of the element remains the same and will not rotate with the direction of the line ....
I tied the data with (semicolon) on vue s {} template syntax and was escaped on url. How can I escape back or avoid taking it with me? <router-link :to="{ path: pingou 14,query: {attr_id:attributes}}">< router-link> attribu...
the h5 application made by the company has the problem of style distortion caused by the virtual keys (home key, return key, etc.) at the bottom of the phone during the test ...
when VScode comments the jsx in the react file, is there any configuration missing from the used in front of the code? ...
what I want to do is to display the loading.gif diagram when the picture is not loaded. my picture (figure 9) is in a div1, and the address of the picture is in the array imgPath = []. When the array is empty, the div1, of div1 is created when the ar...
mongodb node mongodb node request mongodb con ...
the renamed data cannot be returned after receiving the file using formidable and renaming the saved file The last picPath returned by was always empty, and it turned out to be asynchronous, and then I wrote it in the callback of from.on ( "end "). ...
I want to learn the core principle of modular loader. Now it can dynamically load files and prevent overloading, but at present, it is stuck in the callback function to receive parameters. Please give me some advice. Thank you. for example: A.js requ...
A headache. I want to match a positive integer, but it doesn t include something like 1.0, so I want to convert a string first, and then go to the matching point regularly. as a result, if any form of conversion fails, 1.0 will be converted to 1. and d...
after using the intermediate proxy layer built with webpack + koa2 + react, the front-end react-router simply cannot be used, because as soon as the browser is refreshed, the routing of koa2 will be triggered. How the routing problem is handled in such a...
php is empty ...
for example, now I have a bunch of strings, such as: my mother takes me * *. now how do I convert "Mom take me " to Mom take me and render it in react as bold. instead of rendering to Mom take me * or like this ...
when learning redux middleware, I found that there are two ways to write applyMiddleware, but this is the only one in official documents const store = createStore (reducer, preloadedState, applyMiddleware (. Middleware) but I saw this way of writing ...