Does anyone knows node-red has union and struct can define and use?

Dear All :

Like title.

Thank u.

Node-RED is written in JavaScript, so has all the capabilities that language has to offer.

1 Like

Dear dceejay :

Yeah, Does it like below :

    int A;
    char B[2];
} AZ;

Cause I can not search it at google...

Thank u.

JavaScript is not statically typed.
JavaScript does not have unions.
JavaScript does not have structs.

You can only create an object.

const AZ = {
  A: 0,
  B: ""
AZ.A = 123;
AZ.B = "one two three";

or make a function

function makeAZ(A, B) {
  return {
    A: A,
    B: B
const AZ = makeAZ(123, "one two three");

or make a class and then instantiate instances.

Dear Steve-Mcl :

I will try it.

Thank u.

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