aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes simple question but weird. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "simple question but weird. " Watch "simple question but weird. " New topic
Author

simple question but weird.

Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
var i = 0;
myform['info.rates['+i+'].coupon'];

1. here, '+i+' , what is its meaning? so weird .

2. what is the rule using "" and ''? which is defined as standard? '' could include '' inside?

Thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61426
    
  67

1) It's just simple string concatentation. Perhaps if it were written:

'info.rates[' + i + '].coupon'

would it make more sense to you?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61426
    
  67

2) Either double or single quotes can be used to delimit strings.

To use the same quote character inside the string as is used to delimit it, you need to escape the internal quote with the back-slash character. For example:

'I saw O\'Brien the other day'
Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
thanks. I got it.
 
Consider Paul's rocket mass heater.
 
subject: simple question but weird.