| |

VerySource

 Forgot password?
 Register
Search
View: 1220|Reply: 5

About variables

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-26 13:00:01
| Show all posts |Read mode
var a;
function CheckNewMsg ()
{
a = '1';
}
alert (a);
CheckNewMsg () is called when the page is loaded to assign a, how can the value of a be saved outside the function?
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-2-17 16:15:01
| Show all posts
Just use a as a global variable!
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-2-18 11:45:01
| Show all posts
How to define global variables in JavaScript?
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-2-20 17:30:01
| Show all posts
You have defined global variables like this
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-22 20:00:02
| Show all posts
There is a problem as you said?
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-23 14:30:01
| Show all posts
You may be calling in the wrong order.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list