# Javascript does not work ;-)

**URL:** https://discourse.nodered.org/t/javascript-does-not-work/55349
**Category:** General
**Created:** [17 December 2021 16:38 UTC](https://discourse.nodered.org/t/javascript-does-not-work/55349 "2021-12-17T16:38:32Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![nosered1966](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nosered1966/32/52859_2.png) [@nosered1966](https://discourse.nodered.org/u/nosered1966)
#### Post date: [17 December 2021 16:38 UTC](https://discourse.nodered.org/t/javascript-does-not-work/55349/1 "2021-12-17T16:38:32Z")

</div>

Hi all,

I am totally new in Node Red and Javascript and **I am no SW developer** and probably **this** is already the answer to my question. I have only a little experience in writing [vb.net](http://vb.net) and vba software doing this as a hobby but this problem is driving me crazy and I don't want to waste more and more time with this! That's why I ask for help!

The question is:  
Why do I have this error shown in the debug area?  
I think it comes from the code marked yellow.  
But why?  
Variable "PVPowerRange\_Initial" is used before without any error (marked green)!

Thank you all in advance and sorry for the stupid question!  
And please: Don't tell me details about the code in general! I am sure, it can be done much more smarter, but this is not what I am asking for.

🙄

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/7/676f5793503ae8eeec52fb3db3e925adfe12f0ea.png)

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [17 December 2021 16:42 UTC](https://discourse.nodered.org/t/javascript-does-not-work/55349/2 "2021-12-17T16:42:10Z")

</div>

> [@nosered1966](#):
>
> "PVPowerRange\_Initial"

is a string not a var, as it has quotes round it. You later refer to it as a var `PVPowerRange_Initial` with no quotes. As it never existed as a var only a string you get the undefined error.

---

<div class="post-metadata">

### Author: ![nosered1966](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nosered1966/32/52859_2.png) [@nosered1966](https://discourse.nodered.org/u/nosered1966)
#### Post date: [17 December 2021 17:54 UTC](https://discourse.nodered.org/t/javascript-does-not-work/55349/3 "2021-12-17T17:54:24Z")

</div>

@E1cid: I think you are right. I deleted all " (what's that in english?), but it still does not work...  
I will check it and come back.  
Until then many thanks!!!

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [17 December 2021 18:18 UTC](https://discourse.nodered.org/t/javascript-does-not-work/55349/4 "2021-12-17T18:18:22Z")

</div>

I don't think you were supposed to delete the "quotes" but add "quotes" around the one that was missing them.

If you enable Monaco in your settings file it will help you with JavaScript syntax.

Ps. When pasting code, it is far better to post the actual code (not a screenshot). Be sure to use the `</>` code button before pasting the code.

---

<div class="post-metadata">

### Author: ![nosered1966](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nosered1966/32/52859_2.png) [@nosered1966](https://discourse.nodered.org/u/nosered1966)
#### Post date: [17 December 2021 18:25 UTC](https://discourse.nodered.org/t/javascript-does-not-work/55349/5 "2021-12-17T18:25:06Z")

</div>

@E1cid already told me to do so!

Thank you too for your help!

---

<div class="post-metadata">

### Author: ![nosered1966](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nosered1966/32/52859_2.png) [@nosered1966](https://discourse.nodered.org/u/nosered1966)
#### Post date: [17 December 2021 21:20 UTC](https://discourse.nodered.org/t/javascript-does-not-work/55349/6 "2021-12-17T21:20:04Z")

</div>

> [@Steve-Mcl](#):
>
> enable Monaco

And you think I can manage this without detailed advice?  
Unfortunately not.  
🥴

But I would like to do it ...

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [17 December 2021 21:45 UTC](https://discourse.nodered.org/t/javascript-does-not-work/55349/7 "2021-12-17T21:45:04Z")

</div>

A simple search on this forum will reveal the answer 😀

Or search Google "node-red enable Monaco" E.g: [Updating to node-red version 2.0 | Enable the Monaco Javascript Editor for rich developer experience - YouTube](https://youtu.be/7WEMGUg6oJ8)

---

<div class="post-metadata">

### Author: ![nosered1966](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nosered1966/32/52859_2.png) [@nosered1966](https://discourse.nodered.org/u/nosered1966)
#### Post date: [17 December 2021 21:50 UTC](https://discourse.nodered.org/t/javascript-does-not-work/55349/8 "2021-12-17T21:50:15Z")

</div>

I'll take the video, thx!  
📺

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [31 December 2021 21:50 UTC](https://discourse.nodered.org/t/javascript-does-not-work/55349/9 "2021-12-31T21:50:51Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
