Conditional statements in javascript, JAVA Programming

Assignment Help:

Very frequently when you write code, you desire to perform distinct actions for different decisions. You can employ conditional statements in your code to do this.

In JavaScript we contain three conditional statements which are following:

  • if statement - employ this statement if you desire to execute a set of code when a condition is true
  • if...else statement - employ this statement if you desire to select one of two sets of code to execute
  • switch statement - employ this statement if you desire to choose one of many sets of code to execute

if( myVariable == 2 ) {

myVariable = 1;

} else {

myVariable = 0;

}

If the value of myVariable in code is 2 then the first condition appraise to true and the value of myVariable is set to 1. If it is anything apart 2 then the else part gets executed.

Now let us see an instance of a nested if statement in above code

if ( myVariable == 2 ) {

myVariable = 1;

} else {

If (myVariable == 5 ) {

myVariable = 3;

} else {

myVariable = 4;

}

}


Related Discussions:- Conditional statements in javascript

Nested if.., WAP to input a 4 digit no and find greatest using nested if

WAP to input a 4 digit no and find greatest using nested if

Write an application for a video store , a. Write an application for a vide...

a. Write an application for a video store. Place the names of 10 of your favorite movies in a combo box. Let the user select a movie to rent. Let the user select a movie to rent. D

On bluej, I need to write a program to assign values to the variable age an...

I need to write a program to assign values to the variable age and print the reason as major or minor.

Build an android app like the example in the project details, Build an andr...

Build an android app like the example in the project details Project Description: Construct an android app like cam finder using my own ideas, design and features which I wil

Need professional framework coder with coding experience, Need Professional...

Need Professional Framework Coder with Video Coding Experience? Project Description: Professional Framework Coder with Video Coding experience. You must know API, Java, C++,

#title.using linked list, Write a program that takes as input a sequence of...

Write a program that takes as input a sequence of transactions of the form

We require responsible and serious programmer, We require responsible and s...

We require responsible and serious programmer Project Description: Big Data and On-line tools Website Liferay - JAVA - Portlets - JSP and JSF Skills required: J2EE,

Questions pseudocodes, 1. Write the pseudocode to get the input of 10 integ...

1. Write the pseudocode to get the input of 10 integers from the user and add them up and output the total. (4 points) 2. Compute the output of following pseudocode. Assume that

What are the kinds of computer network among nodes, What are the kinds of c...

What are the kinds of computer network according to the distance among nodes? the kinds of computer network according to the distance among nodes are as follows: There are t

2D arrays, write an application that stores at least five different departm...

write an application that stores at least five different department and supervisor names in a two dimensional array

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd