Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the three major structures of the front end of Web

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "what are the three major structures of the Web front end". In the daily operation, I believe that many people have doubts about what the three major structures of the Web front end are. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the questions of "what are the three major structures of the Web front end?" Next, please follow the editor to study!

The three major structures of the program:

1. Sequential structure

two。 Select structure

3. Cyclic structure

If () {} judgment statement

If (true) {

/ / execute the statement

}

If (false) {

/ / skip this statement

}

If (ture) {/ / execute statement 1 when the result in if parentheses is true, otherwise execute statement 2

/ / statement 1

} else {

/ / statement 2

}

What is in parentheses in if () we usually call it a logical point.

A strange question.

If (/ / all kinds of strange things will happen in this parenthesis)

If (1) {

Alert ('watch me pop it up to show you')

}

It feels weird:

What do you fill in the brackets of 1.if?

2.1is it true?

Why did this happen? In some specific cases, the computer does implicit type conversion. Unlike Number, he doesn't need you to do anything. He will convert the data types automatically.

In the operation, and if (in parentheses), implicit type conversions occur.

1. Implicit type conversion in operations:

Var astatine 1', bread2

What's wrong with it?

The + operator has two meanings, the first meaning is the + operation in mathematics, and the second meaning is string concatenation, giving priority to string concatenation, so when it is detected that there are strings on the left and right sides of the operator, the numbers on the left and right sides of the operator will be converted into strings for operation.

A murmur baked goods?

In addition to the two meanings of the + operator,-* / has only mathematical meaning, so the data types on both sides of the operator are implicitly converted to numeric types by default when performing the-* / operation.

2.if (in parentheses) implicit type conversion.

As we all know, only Boolean values are needed in if parentheses. Then in the if judgment, all data types are implicitly converted to Boolean types.

If (non-zero numbers are converted to ture, non-empty strings are converted to true), there are two basic rules, the rest of the rules will be slowly discovered in the future.

Alert (1==true); / / true

Switch ()

Switch (statement) {

Case 0:alert (1)

Break

Case 2:alert (2)

Case 3:alert (3)

Default:alert (10)

}

Case: achievement judgment.

Var achievement = 30; / / score

Var passNum = 60; / / passing score

If (achievement > = passNum) {

Alert ('qualified')

} else {

Alert ('failing grades')

}

Case: show what day of the week.

/ / suppose the first day of each month is Monday, write a program to figure out what day of the month it is.

What's the var day=33;// number?

If (day > = 31 | | day

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report