# Learning Javascript

**URL:** <https://discourse.nodered.org/t/learning-javascript/66845>\
**Category:** General\
**Tags:** function-node\
**Created:** [24 August 2022 10:35 UTC](https://discourse.nodered.org/t/learning-javascript/66845 "2022-08-24T10:35:17Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonathan95](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jonathan95/32/16370_2.png) [@Jonathan95](https://discourse.nodered.org/u/Jonathan95)\
**Post date:** [24 August 2022 10:35 UTC](https://discourse.nodered.org/t/learning-javascript/66845/1 "2022-08-24T10:35:17Z")

</div>

Hey all, hope you guys are having a great week so far.

I am needing a bit of advice... Ive signed up for a JavaScript course trying to learn to use it  
within node red. But .... I cant quite seem to see the connect. I really want to learn JavaScript  
and be able to apply what I learn into Node-Red. I find myself frustrated ....

Does anyone have any advice on my journey to learn JavaScript and applying it in Node-Red?  
I know there is so much functionality embedded in things like the function nodes, I know what  
I want to achieve most of the time but cant put it down or in place.

Thank you in advance guys/gals

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [24 August 2022 10:46 UTC](https://discourse.nodered.org/t/learning-javascript/66845/2 "2022-08-24T10:46:37Z")

</div>

Always search the forum first, if you are unsure of something, as it's likely that someone has encountered the same already.  
You can learn a lot by just reading the posts.  
After this forum, I spend a lot of time in [JavaScript Tutorial](https://www.w3schools.com/js/default.asp) which gives clear description of JavaScript code, as well as examples.

I always write JavaScript in small chunks, and check if it works, before writing more, then it's easier to troubleshoot.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [24 August 2022 11:47 UTC](https://discourse.nodered.org/t/learning-javascript/66845/3 "2022-08-24T11:47:14Z")

</div>

There have been a few other similar requests in the forum previously so certainly worth looking those up.

Specifically, the Mozilla Developer Network (MDN) is the modern bible on JavaScript. They have THE go-to reference but they also have some great learning resources. Microsoft also have some excellent training and learning materials.

---

<div class="post-metadata">

**Author:** ![iiot2k](https://avatars.discourse-cdn.com/v4/letter/i/8baadc/32.png) [@iiot2k](https://discourse.nodered.org/u/iiot2k)\
**Post date:** [24 August 2022 13:15 UTC](https://discourse.nodered.org/t/learning-javascript/66845/4 "2022-08-24T13:15:31Z")

</div>

Everyone has their own way of learning something.  
There are said to be people who learn to ride a bike from a book.  
But as mere mortals, we have to take the hard road and get on the bike.  
I personally fall asleep with too much theory.  
But there must be some theory.  
Set yourself tasks and solve them.  
In the internet is definitely the solution for this.  
See how others have solved it.  
The wow effect comes by itself.  
I also looked at begin why the function does not work.  
The answer was that I never called the Function.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [24 August 2022 14:14 UTC](https://discourse.nodered.org/t/learning-javascript/66845/5 "2022-08-24T14:14:02Z")

</div>

> [@iiot2k](#):
>
> But as mere mortals, we have to take the hard road and get on the bike.

Very true 👍

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [24 August 2022 16:17 UTC](https://discourse.nodered.org/t/learning-javascript/66845/6 "2022-08-24T16:17:50Z")

</div>

Agree. This is a great approach. However, I'd say that you then want to go back and fill in some gaps and a mix of courses and blog posts etc will help that enormously.

> [@iiot2k](#):
>
> But as mere mortals, we have to take the hard road and get on the bike

Personally, I vaugly remember that I learned more by falling off than getting on!! 🤣

---

<div class="post-metadata">

**Author:** ![Jonathan95](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jonathan95/32/16370_2.png) [@Jonathan95](https://discourse.nodered.org/u/Jonathan95)\
**Post date:** [25 August 2022 07:38 UTC](https://discourse.nodered.org/t/learning-javascript/66845/7 "2022-08-25T07:38:34Z")

</div>

@Paul-Reed  
Luckily enough just like you say the forum is a trove of knowledge. Its helped me write some of my first functional function nodes. Taking "un-formated" data and being able to form it correctly and actually use it.  
Being able to test others code and make variances on others code or input helps a bunch in understanding the relationship. Also thanks for the resource, Never came across this and it looks  
really informative.

@TotallyInformation  
I actually thought it was a really bad question to ask. I feel like a real noob thats asking a ridiculous  
question. Didnt believe anyone would have asked before actually. I will look those up and thankyou man.  
I see retention though is only through 2 months. Should I be worried?

Id not heard of that either. MDN also seems worth the check out. Its slightly funny, I checked alot of Microsofts  
training or tutorials and it seemed to be just on their azure stuff.(really helpful by the way. especially  
once I started moving from just my own family 365 plan to MS sharepoint and business related tools.  
Their sharepoint and Azure stuff is very different to how a normal MS 365 account operates.)

@iiot2k  
I think I get where you are coming from.... I usually try to bash myself against the problem for quite a while.  
knowing well that exists far better solutions to what I am doing and its really frustrating that I dont know.  
Lol I get really upset with myself.

Thankyou all,  
I think I am going to go over these resources you have shared and do some smaller tasks to learn and  
better understand how it works within the function node. slowly combining these these would be better I  
believe after reading all of your replies.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [25 August 2022 08:51 UTC](https://discourse.nodered.org/t/learning-javascript/66845/8 "2022-08-25T08:51:31Z")

</div>

> [@Jonathan95](#):
>
> I actually thought it was a really bad question to ask. I feel like a real noob thats asking a ridiculous  
> question. Didnt believe anyone would have asked before actually. I will look those up and thankyou man.

Not at all, there are no stupid questions only stupid answers 😃

Node-RED is many people's introduction to JavaScript since it is an easy entry point but it quickly sucks you in as you realise just how much you can achieve! Even for those of us who have used JS for many years still appreciate the ease of entry that Node-RED gives, it does a lot of the boring bits and lets you focus on creativity.

But JS is a fairly nasty language in truth so there is certainly no shame in needing additional help. I regularly have to look up how to do things as I'm not a full-time programmer. However, JS can be used for both the front- and back-ends, it is quite flexible and, thanks to the focus on it over the years, is remarkably fast.

> [@Jonathan95](#):
>
> I see retention though is only through 2 months. Should I be worried?

Retention of what? The forum? You can use search to look for anything.

> [@Jonathan95](#):
>
> MS sharepoint and business related tools

Yes, that is stuff I've been working on for the last 10 years now - and it isn't even the focus of my job, just there was nobody else to do it.

> [@Jonathan95](#):
>
> I checked alot of Microsofts  
> training or tutorials and it seemed to be just on their azure stuff

Well, they always want to draw you in, but once you hit on their more general stuff, they have some great resources. I mention them because I work closely with MS and so come across more of their stuff.

---

<div class="post-metadata">

**Author:** ![Jonathan95](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jonathan95/32/16370_2.png) [@Jonathan95](https://discourse.nodered.org/u/Jonathan95)\
**Post date:** [29 August 2022 19:23 UTC](https://discourse.nodered.org/t/learning-javascript/66845/9 "2022-08-29T19:23:22Z")

</div>

Hey that might be the case but certainly feels that way at times.  
Its like such an integral part once you get more stuck into Node Red.  
I am sure its really involved the deeper you go and put aside Node Red and Javascript would likely be  
much much more involved.

There is a guy called peter I work with and some of what hes put in the function nodes is incredible.  
I dont really understand it all but it works really fast and its solid too! We use it on a powerplant for a bunch of reporting with it actually doing more for us than the built in SCADA.

the retention portion is. it seems to indicate that the post might be deleted in 2 or 3 months after the last post has been posted . Or I think its that the post would be closed. Not sure but I am sure I read it that it would be deleted?

Thanks to all the resources in this topic. Id also managed to stumble upon that MS seem to have a good few courses up for free at the moment with Certs after completion. There is unfortuantely a 3rd party thats managing our MS infrastructure and its a little frustrating cause it feels like I am locked out of so much hahaha.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [29 August 2022 19:56 UTC](https://discourse.nodered.org/t/learning-javascript/66845/10 "2022-08-29T19:56:56Z")

</div>

> [@Jonathan95](#):
>
> Or I think its that the post would be closed. Not sure but I am sure I read it that it would be deleted?

Old posts are not deleted, only closed.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [29 August 2022 20:55 UTC](https://discourse.nodered.org/t/learning-javascript/66845/11 "2022-08-29T20:55:41Z")

</div>

> [@Jonathan95](#):
>
> There is a guy called peter I work with and some of what hes put in the function nodes is incredible.  
> I dont really understand it all but it works really fast and its solid too!

I would caution you not to be too quick to write Javascript in a function node for a given task.  
If you look through the forum you will quite often find alternative solutions for the same problem: a function, a JSONata expression or a few standard nodes. Sometimes a call to a shell script or a C program are suggested too. All perfectly valid ways of using Node-red but I bet that in a year's time the "low code" way with standard nodes is the easiest to understand and modify.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [30 August 2022 11:07 UTC](https://discourse.nodered.org/t/learning-javascript/66845/12 "2022-08-30T11:07:18Z")

</div>

Don't disagree, but to put the balancing thought ... As Node-RED is also an excellent prototyping tool, I often end up creating a rats nest of nodes to achieve something quickly then go back and simplify. Quite often I end up replacing a bunch of nodes with a single function node with well-commented code. That can be more efficient and easier to follow the logic sometimes.

Bottom line is that there isn't a single "Right" (capital R) way of doing things. Whatever works best for you and your team (and your customers) is "Right" for you. However, learning JavaScript will never be wasted effort. I just wouldn't get too carried away with the learning up front - at least if you have some basic programming knowledge in other languages - simply because JavaScript is quite complex and unless you are using it every day, you will likely forget the details anyway. So knowing how/where to look things up is likely to be equally important.

---

<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:** [29 October 2022 11:07 UTC](https://discourse.nodered.org/t/learning-javascript/66845/13 "2022-10-29T11:07:50Z")

</div>

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