Basic JavaScript – Exercise 06 -Conditional Statements

Previous Next Conditional statements in JavaScript uses if-else or switch statement that change the direction of the program in run-time. The conditional statement check certain conditions and then based on the truth value of the condition, execute a block of code. The if-else statements could be nested to make a if-if-else-else or if-else- else-if statements. … Read more

Basic JavaScript- Exercise-05 – Variable Declarations

Previous Next Variables are the most important element of any programming language. Variables hold values so that you can write expressions using them.You evaluate the expressions and again use a variable to store the results. In JavaScript, variables are created using keyword “var”. There is no need to declare the type of the variable before … Read more

JavaScript – Exercise 10 : The While Loop

Previous Next Just as the “for loop” repeated all the statements within the loop body, “while loop” also does the same thing. It is another type of loop that repeats everything inside the loop until the loop condition is false. The typical structure of while loop is given below. The working of the “While Loop” … Read more

Basic JavaScript: Exercise 03 : Alert Boxes

Previous Next When a user makes mistake, the browser does not give feedback to users unless it is a server response or browser-based error. For example, when you cannot reach a web page, you receive HTML error 404 which means “web page not found“. There are a lot of server-side errors, a common error is … Read more

Basic JavaScript: Exercise 02 : Output to HTML

Previous Next In JavaScript exercise 1, you printed the output directly from the JavaScript program. There was no formatting. This is the way JavaScript program works, but HTML documents are meant to present information in a human-readable format with some style information. Imagine reading plain notepad like web pages, there is no fun in that. … Read more

Basic JavaScript – Exercise 01-First Script

Previous Next JavaScript is a browser-based scripting language. It means you can control certain things on a browser like validating user input, throw an alert and so on. These are some common examples, JavaScript can do much more than this. A web developer must know how to write JavaScript programs because these are basic skills … Read more

Repeat A String

Previous Next In JavaScript, there are several in-built functions to manipulate strings. One of them is String.prototype.repeat() function. In this tutorial, you will write a program that will repeat a string for a given number of times. The steps that this program follows is given below: JavaScript function receives an input string and a number … Read more

Find The Largest Number

Previous Next In this example, we will receive a two-dimensional array of numbers as input and the JavaScript function will find the largest in each sub-array and return the result in a new array. The program takes following steps to compute the results: Receive an array with many sub-arrays. Set a maximum number variable. Loop … Read more

Find Longest Word in a String

Previous Next In this example, you will create a JavaScript function that will accept a string that contains multiple words and find the longest among those words and display the length of the string. The program takes following steps to find the longest string. Accept the string in a function – findLengthLongest(). Use JavaScript regex … Read more

Reverse a String

Previous Next In this example, we will create a program using JavaScript and HTML to reverse a given string and display the output. The JavaScript code will accept a string from a HTML textbox control and reverse the string and output the result to a H1 element to display. The step to reverse the string … Read more

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.