Skip to main content

JAVASCRIPT PROGRAMMING CONSTRUCTS




Most of the programming languages have a common set of programming constructs. JavaScript also provides a complete range of basic programming constructs.

JavaScript Conditional Statements

As in any other programming language conditional statements in JavaScript are used to perform different actions based on different conditions. While writing a code you may want to perform different actions for different decisions. For this JavaScript has following conditional statements:
1. If statement - use this statement if you want to execute some code only if a specified condition is true.
Syntax

if (condition)
{
/* code to be executed if condition is true*/
}

E.g. Using if statement



E.g.



Note: in case If is written in lowercase letters using uppercase letters (IF) will generate a JavaScript error!
2. if...else statement:- This statement is used if you want to execute some code if the condition is true and any another code if the condition is false.
Syntax:
if (condition)
{
// code executed if condition is true
}
else
{
// code executed if condition is not true
}
E.g. Displaying Greeting using if else construct

3. if...else if....else statement - use this statement if you want to select one of many blocks of code to be executed.
Syntax:
if (condition1)
{
//code to be executed if condition1 is true
}
else if (condition2)
{
//code to be executed if condition2 is true
}
else
{
//code to be executed if condition1 and condition2 are not true
}
E.g. if...else if....else statement


Note: While comparing variables you must always use two equals signs next to each other (==)!. In such case code executed only if the specified condition is true.
5. Switch statement – You can use Switch statement to select one of many blocks of code that is to be executed. With the Switch statement you can select from a number of alternatives.
Syntax:
switch(value)
{
Case 1:
//This code executed if first alternative is chosed
break;
Case 2;
//This code executed if second alternative is chosed
break;
default://used to take a default action
}
Note: You need to use break to come out of the Switch statement once selected case code is executed

Comments

Popular posts from this blog

Advantages and Disadvantages of EIS Advantages of EIS Easy for upper-level executives to use, extensive computer experience is not required in operations Provides timely delivery of company summary information Information that is provided is better understood Filters data for management Improves to tracking information Offers efficiency to decision makers Disadvantages of EIS System dependent Limited functionality, by design Information overload for some managers Benefits hard to quantify High implementation costs System may become slow, large, and hard to manage Need good internal processes for data management May lead to less reliable and less secure data

Inter-Organizational Value Chain

The value chain of   a company is part of over all value chain. The over all competitive advantage of an organization is not just dependent on the quality and efficiency of the company and quality of products but also upon the that of its suppliers and wholesalers and retailers it may use. The analysis of overall supply chain is called the value system. Different parts of the value chain 1.  Supplier     2.  Firm       3.   Channel 4 .   Buyer

CONCEPTUAL VIEW OF MIS

The concept is a blend of principles, theories and practices of management, information and system giving rise to a single product called MANAGEMENT INFORMATION SYSTEM . The concept of management gives high regard to the individual and his ability to use the information. MIS gives information through data analysis. While analyzing the information, it relies on many academic disciplines like management science, OR, organization behavior, psychology, etc. The foundation of MIS is the principles of management and its practices. MIS uses the concept of management control in its design and relies heavily on the fact that the decision maker is a human being and is a human processor of information. A MIS can be evolved for a specific objective it is evolved after systematic planning and design. It calls for an analysis of business, management views and policies, organization culture and the management style. The MIS,therefore relies heavily on systems theory.The systems theory offers soluti