Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
do while loop in JavaScript
Play lesson

JavaScript Tutorial - do while loop in JavaScript

4.0 (0)
13 learners

What you'll learn

This course includes

  • 12.3 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

Link for all dot net and sql server video tutorial playlists http://www.youtube.com/user/kudvenkat/playlists Link for slides, code samples and text version of the video http://csharp-video-tutorials.blogspot.com/2014/11/do-while-loop-in-javascript.html Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help. https://www.youtube.com/channel/UC7sEwIXM_YfAMyonQCrGfWA/?sub_confirmation=1 In this video we will discuss do while loop in JavaScript with an example. In Part 16 we discussed while loop. Please watch Part 16 before proceeding. while loop : 1. while loop checks the condition first 2. If the condition is true, statements with in the loop are executed 3. This process is repeated as long as the condition evaluates to true. do while loop : 1. do while loop checks its condition at the end of the loop 2. This means the do...while... loop is guaranteed to execute at least one time. 3. In general, do...while... loops are used to present a menu to the user What is the difference between while and do while in javascript 1. while loop checks the condition at the beginning, where as do...while... loop checks the condition at the end of the loop 2. do...while... loop is guaranteed to execute at least once, where as while loop is not. do while loop example var userChoice = ""; do { var targetNumber = Number(prompt("Please enter your target number", "")); var start = 0; while (start [= targetNumber) { document.write(start + "[br/]"); start = start + 2; } do { userChoice = prompt("Do you want to continue - Yes or No").toUpperCase(); if (userChoice != "YES" && userChoice != "NO") { alert("Invalid choice. Please say, Yes or No"); } } while (userChoice != "YES" && userChoice != "NO"); } while (userChoice == "YES");

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere