# A javascript problem when learning Beast

**URL:** <https://www.ruby-forum.com/t/a-javascript-problem-when-learning-beast/104369>\
**Category:** Deployment\
**Created:** [May 17, 2007, 8:54am UTC](https://www.ruby-forum.com/t/a-javascript-problem-when-learning-beast/104369 "2007-05-17T08:54:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yananay](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/5daacb/32.png) [@yananay](https://www.ruby-forum.com/u/yananay)\
**Post date:** [May 17, 2007, 8:54am UTC](https://www.ruby-forum.com/t/a-javascript-problem-when-learning-beast/104369/1 "2007-05-17T08:54:25Z")

</div>

now i’m learning the Beast source code,  
but a problem happened when read the javascript like below:

var TopicForm = {  
editNewTitle: function(txtField) {  
$(‘new\_topic’).innerHTML = (txtField.value.length \> 5) ?  
txtField.value : ‘New Topic’;  
}  
}

what’s the meanning of  
" var xxx = {

} " ?

i haven’t known such using…

appricated if you can give me some adivce or any useful link 🙂

thanks!

---

<div class="post-metadata">

**Author:** ![yananay](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/5daacb/32.png) [@yananay](https://www.ruby-forum.com/u/yananay)\
**Post date:** [May 17, 2007, 3:55pm UTC](https://www.ruby-forum.com/t/a-javascript-problem-when-learning-beast/104369/2 "2007-05-17T15:55:29Z")

</div>

On 5/17/07, Yan R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> }
> 
> thanks!

var xxx = … is what we in the porn industry use to declare  
javascript variables. The brackets ( {}'s ) is used for declaring an  
object literal.

[http://developer.mozilla.org/en/docs/Core\_JavaScript\_1.5\_Guide:Literals#Object\_Literals](http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Literals#Object_Literals)

Also, you’ll probably get more intelligent responses in the  
rails-spinoff thread, which is dedicated to prototype/scriptaculous.

–  
Rick O.  
[http://lighthouseapp.com](http://lighthouseapp.com)  
[http://weblog.techno-weenie.net](http://weblog.techno-weenie.net)  
[http://mephistoblog.com](http://mephistoblog.com)

---

<div class="post-metadata">

**Author:** ![yananay](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/5daacb/32.png) [@yananay](https://www.ruby-forum.com/u/yananay)\
**Post date:** [May 18, 2007, 3:54am UTC](https://www.ruby-forum.com/t/a-javascript-problem-when-learning-beast/104369/3 "2007-05-18T03:54:27Z")

</div>

thanks!
