break;
makes it jumps out of the loop. You are using break;
out of condition, so the for loop stops after the 1st round anyway. All you need is to remove break;
or add break;
within if or else condition as you need.
More Related Contents:
- In JavaScript, how to conditionally add a member to an object?
- What is the meaning of “$” sign in JavaScript
- Uploading multiple files using formData()
- Converting .NET DateTime to JSON [duplicate]
- JavaScript Document.Write Replaces All Body Content When Using AJAX
- Changing nav-bar color after scrolling?
- Setting multiple attributes for an element at once with JavaScript
- How to filter an array in javascript?
- Objects are not valid as a React child (found: [object Promise])
- Displaying a byte array as an image using JavaScript
- Scrolling to top of the page in Python using Selenium
- shorthand http:// as // for script and link tags? anyone see / use this before?
- Asynchronous Script Loading Callback
- Finding number of lines in an html textarea
- Regex to split camel case
- Javascript Typed Arrays and Endianness
- Eliminate 300ms delay on click events in mobile Safari
- how to reset module imported between tests
- Google Maps Api v3 – getBounds is undefined
- What does useCallback/useMemo do in React?
- Impossible to hide navigation bars in Safari iOS 7 for iPhone/iPod touch
- How to hide bottom navigation bar on a specific screen in react native?
- document.execCommand() FontSize in pixels?
- Using Express Handlebars and Angular JS
- Controlling a Firefox Extension via Javascript
- Find what javascript changes the DOM?
- Array.of vs “[ ]”. When to use Array.of over “[ ]”?
- convert HTML ( having Javascript ) to PDF using JavaScript [closed]
- Combination of animation and transition not working properly
- Javascript Date() give wrong date off by one hour