Learning Javascript

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

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 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.

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.

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.

1 Like

Very true :+1:

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.

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

@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.

Not at all, there are no stupid questions only stupid answers :smiley:

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.

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

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.

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.

2 Likes

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.

Old posts are not deleted, only closed.

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.

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.

1 Like