-
Jun 11th, 2014, 05:53 PM
#1
Thread Starter
PowerPoster
Declare java script variables
Total Newbie to java script
Is this the correct way to declare variables ?
<head>
<script type='text/javascript'>
var InPutFeet;//feet entered by user
var Multipler;// Based on pitch selected from combobox eg; .25, .41 etc
var FeetToAdd;//feet entered by user x Multipler
var TotalFeet;//Total square feet with pitch added
var TotalSquares;// TotalFeet / 100
</script>
</head>
Waiting for a full featured smart phone with out marrying a provider
Go Android
Go raiders
-
Jun 11th, 2014, 07:01 PM
#2
Re: Declare java script variables
Yes, you have properly declared variables there. However, those are all global scope variables, as you don't have them in a 'class' or a function.
-
Jun 12th, 2014, 01:27 AM
#3
Re: Declare java script variables
Also note the character casing, as this is not as friendly as VB. Had to find out the hard way.
About global variables: There is also a very ugly way to declare them inside a function and still have them as global. You can do that without using the "var" . I wouldn't recommend this approach, unless there is something very specific to do.
Last edited by sapator; Jun 12th, 2014 at 01:32 AM.
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Jun 16th, 2014, 08:29 PM
#4
Thread Starter
PowerPoster
Re: Declare java script variables
Waiting for a full featured smart phone with out marrying a provider
Go Android
Go raiders
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|