# Where or how does the function defined?

**URL:** https://meta.discourse.org/t/where-or-how-does-the-function-defined/52256
**Category:** Development
**Created:** [October 31, 2016, 8:43am UTC](https://meta.discourse.org/t/where-or-how-does-the-function-defined/52256 "2016-10-31T08:43:25Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![helperhaps](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/helperhaps/32/59201_2.png) [@helperhaps](https://meta.discourse.org/u/helperhaps)
#### Post date: [October 31, 2016, 8:43am UTC](https://meta.discourse.org/t/where-or-how-does-the-function-defined/52256/1 "2016-10-31T08:43:25Z")

</div>

How does this line work? I can not find where the method defined or how the function defined.

[https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/models/nav-item.js.es6#L110](https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/models/nav-item.js.es6#L110)

I mean if i want to add a top-menu, how does it works?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [October 31, 2016, 1:32pm UTC](https://meta.discourse.org/t/where-or-how-does-the-function-defined/52256/2 "2016-10-31T13:32:29Z")

</div>

I believe top menu is a string in the format: “first|second|third|fourth”

IE, a pipe delimited array in a string.

To add a top-menu item use this:

[https://meta.discourse.org/t/adding-items-to-navigation-bar/26830/8?u=falco](https://meta.discourse.org/t/adding-items-to-navigation-bar/26830/8)
