Closed Bug 1424590 Opened 7 years ago Closed 7 years ago

{{LearnSidebar}} Cannot read property 'indexOf' of undefined

Categories

(developer.mozilla.org Graveyard :: KumaScript, defect)

All
Other
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1362200

People

(Reporter: suraj1101, Unassigned)

References

Details

(Whiteboard: [specification][type:bug])

What did you do? ================ 1. Click on edit of a page containing LearnSidebar section e.g https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Functions for editorial review 2. Click on preview (no need of adding any edit) What happened? ============== Shows a TemplateParserError: Error type: TemplateExecutionError In macro: LearnSidebar (View Macro) Parsing macro: LearnSidebar ([]) Full text of error: Problem executing template LearnSidebar: 1 | <div>{{LearnSidebar}}<br></div><div>{{PreviousMenuNext("Learn/JavaScript/Building_blocks/Looping_code","Learn/JavaScript/Building_blocks/Build_your_own_function", "Learn/JavaScript/Building_blocks")}}</div><p class="summary">Another essential concept in coding is <strong>functions</strong>, which allow you to store a piece of code that does a single task inside a defined block, and then call that code whenever you need it using a single short command — rather than having to type out the same code multiple times. In this article we'll explore fundamental concepts behind functions such as basic syntax, how to invoke and define them, scope, and parameters.</p><table class="learn-box standard-table cke_show_border"><tbody><tr><th scope="row">Prerequisites:</th><td>Basic computer literacy, a basic understanding of HTML and CSS, <a data-cke-saved-href="/en-US/docs/Learn/JavaScript/First_steps" href="/en-US/docs/Learn/JavaScript/First_steps">JavaScript first steps</a>.</td></tr><tr><th scope="row">Objective:</th><td>To understand the fundamental concepts behind JavaScript functions.</td></tr></tbody></table><h2 id="Where_do_I_find_functions">Where do I find functions?</h2><p>In JavaScript, you'll find functions everywhere. In fact, we've been using functions all the way through the course so far; we've just not been talking about them very much. Now is the time, however, for us to start talking about functions explicitly, and really exploring their syntax.</p><p>Pretty much anytime you make use of a JavaScript structure that features a pair of parentheses — <code>()</code> — and you're <strong>not</strong> using a common built-in language structure like a <a data-cke-saved-href="/en-US/Learn/JavaScript/Building_blocks/Looping_code#The_standard_for_loop" href="/en-US/Learn/JavaScript/Building_blocks/Looping_code#The_standard_for_loop">for loop</a>, <a data-cke-saved-href="/en-US/Learn/JavaScript/Building_blocks/Looping_code#while_and_do_..._while" href="/en-US/Learn/JavaScript/Building_blocks/Looping_code#while_and_do_..._while">while or do...while loop</a>, or <a data-cke-saved-href="/en-US/Learn/JavaScript/Building_blocks/conditionals#if_..._else_statements" href="/en-US/Learn/JavaScript/Building_blocks/conditionals#if_..._else_statements">if...else statement</a>, you are making use of a function.</p><h2 id="Built-in_browser_functions">Built-in browser functions</h2><p>We've made use of functions built in to the browser a lot in this course. Every time we manipulated a text string, for example:</p><pre class="brush: js">var myText = 'I am a string'; -------------^ 2 | var newString = myText.replace('string', 'sausage'); 3 | console.log(newString); TypeError: ejs:703 701| 702| <ol> >> 703| <li data-default-state="<%=currentPageIsUnder('Getting_started_with_the_web')%>"><a href="<%=baseURL%>Getting_started_with_the_web"><strong><%=text['Complete_beginners']%></strong></a></li> 704| <li data-default-state="<%=currentPageIsUnder('Getting_started_with_the_web')%>"><a href="<%=baseURL%>Getting_started_with_the_web"><%=text['Getting_started_with_the_web']%></a> 705| <ol> 706| <li><a href="<%=baseURL%>Getting_started_with_the_web"><%=text['Getting_started_with_the_web_overview']%></a></li> Cannot read property 'indexOf' of undefined at currentPageIsUnder (eval at compile (/node_modules/ejs/lib/ejs.js:549:12), <anonymous>:17:11) at eval (eval at compile (/node_modules/ejs/lib/ejs.js:549:12), <anonymous>:710:25) at returnedFn (/node_modules/ejs/lib/ejs.js:580:17) at /app/lib/kumascript/templates.js:71:26 What should have happened? ========================== Should not throw error and show the sidebar Is there anything else we should know? ====================================== I am not sure if this will be introduced if edits get published.
Component: Editing → General
Product: Mozilla Developer Network → Developer Documentation
Same as bug 1362200, but better bug title.
Status: UNCONFIRMED → NEW
Component: General → KumaScript
Ever confirmed: true
Product: Developer Documentation → Mozilla Developer Network
See Also: → 1362200
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.