In 1 node, read several information and make 1 message

Hello, I turn to you again, because I have a difficulty:
on the previous node I read the info from openweather, but I would like to summarize the info on a much shorter post. (and translate it into French that I am)
I have syntax errors? or declaration of variables? (in fact I don't know node red)
can you give me the right wording (i think you will understand what i want to do by reading my program:

let alerte0 = string;
let alerte1 = string;
let alerte2 = string;
let alerte3 = string;
let message1 = string;
let message2 = string;
let message3 = string;
let message4 = string;

 alerte0 = msg.payload.alerts[0];//.event||0;
 alerte1 = msg.payload.alerts[1];//.event||0;
 alerte2 = msg.payload.alerts[2];//.event||0;
 alerte3 = msg.payload.alerts[3];//.event||0;
 message1 = "";
 message2 = "";
 message3 = ""; 
 message4 = "";

if (alerte0=="Moderate rain-flood warning" || alerte1 =="Moderate rain-flood warning" || alerte2 =="Moderate rain-flood warning" || alerte3 =="Moderate rain-flood warning"){
    message1="Pluie"
}
else{ message1="";}
if (alerte0=="Moderate wind warning" || alerte1 =="Moderate wind warning" || alerte2 =="Moderate wind warning" || alerte3 =="Moderate wind warning"){
    message2="Vent"
}
else{ message2="";}
if (alerte0=="Moderate flooding warning" || alerte1 =="Moderate flooding warning" || alerte2 =="Moderate flooding warning" || alerte3 =="Moderate flooding warning"){
    message3="Inondation"
}
else{ message3="";}

if (message1==="" && message2!==""){
    message1=message2;
    message2={};
}
if (message2==="" && message3!==""){
    message2=message3;
    message3={};
}
if (message3==="" && message4!==""){
    message3=message4;
    message4={};
}
    
msg.payload="ALERTE : " + message1 + message2 + message3 + message4 ;    

return msg;

What do you believe that line to be doing? If you are just trying to create a variable called alerte0 then all you need is
let alerte0
The line you have tries to initialise it with the contents of a variable called string which does not exist.

That sets message2 to be an object with no properties, if you want an empty string then you want
message4 = ""

Finally I suggest that you don't use names like message for simple variables, keep names like that for message objects which you are going to pass on to other nodes.

Have you read the docs page Writing Functions? That will give you some help I think.

To add, openweathermap also gives condition codes

using these may simplify your if statements as to weather types. Try creating a look up table for the condition, then use the code to retrive the condition.

Thank you for your very quick response! I analyze your comments and I keep you informed

sorry but I don't understand very well (language barrier and I don't know node red)

here are the changes I made

let alerte0 
let alerte1
let alerte2 
let alerte3
let alarme1
let alarme2
let alarme3
let alarme4

 alerte0 = msg.payload.alerts[0];
 alerte1 = msg.payload.alerts[1];
 alerte2 = msg.payload.alerts[2];
 alerte3 = msg.payload.alerts[3];
 alarme1 = "";
 alarme2 = "";
 alarme3 = ""; 
 alarme4 = "";

if (alerte0=="Moderate rain-flood warning" ||alerte1 =="Moderate rain-flood warning" || alerte2 =="Moderate rain-flood warning" || alerte3 =="Moderate rain-flood warning"){
    alarme1="Pluie"
}
else{ alarme1="";}
if (alerte0=="Moderate wind warning" ||alerte1 =="Moderate wind warning" || alerte2 =="Moderate wind warning" || alerte3 =="Moderate wind warning"){
    alarme2="Vent"
}
else{ alarme2="";}
if (alerte0=="Moderate flooding warning" ||alerte1 =="Moderate flooding warning" || alerte2 =="Moderate flooding warning" || alerte3 =="Moderate flooding warning"){
    alarme3="Inondation"
}
else{ alarme3="";}

if (alarme1==="" && alarme2!==""){
    alarme1=alarme2;
    alarme2={};
}
if (alarme2==="" && alarme3!==""){
    alarme2=alarme3;
    alarme3={};
}
if (alarme3==="" && alarme4!==""){
    alarme3=alarme4;
    alarme4={};
}
    
msg.payload="ALERTE : "+alarme1+alarme2+alarme3+alarme4 ;    

return msg;

there is no more compilation error, but in output display I have "ERROR:"
and however I am with these 3 alerts activate! and I am sure of the way to get this information (msg.payload.alerts [0])
do you have an idea ?

Did you read the docs I suggested? It shows you how to do simple debugging of the function. Also add a debug node showing what is in the message going into the node and check that the payload contains an array called alerts with four elements. If not sure then show use what the debug node gives.

I changed the last line to display the alerte0 message =>
msg.payload="ALERTE : "+alerte0+alarme2+alarme3+alarme4 ;

with that I have output =>
"ALERTE : [object Object]"

at the entry of my node I have:

23/12/2020 à 15:39:24node: 69342ecf.48994

msg.payload : Object

object

lat: 49.02

lon: -0.94

timezone: "Europe/Paris"

timezone_offset: 3600

current: object

minutely: array[61]

daily: array[8]

alerts: array[3]

0: object

sender_name: "METEO-FRANCE"

event: "Moderate rain-flood warning"

start: 1608705180

end: 1608786000

description: "Although rather usual in this region, locally or potentially dangerous phenomena are expected. (such as local winds, summer thunderstorms, rising streams or high waves)"

1: object

sender_name: "METEO-FRANCE"

event: "Moderate wind warning"

start: 1608714060

end: 1608786000

description: "Although rather usual in this region, locally or potentially dangerous phenomena are expected. (such as local winds, summer thunderstorms, rising streams or high waves)"

2: object

sender_name: "METEO-FRANCE"

event: "Moderate flooding warning"

start: 1608714060

end: 1608786000

description: "Although rather usual in this region, locally or potentially dangerous phenomena are expected. (such as local winds, summer thunderstorms, rising streams or high waves)"

The alerts array only has three elements, but you are using four, so the last one is off the end of the array and will be undefined whereas you are testing for an empty string. You can use
if (alert0)
to test if it exists before testing the contents. Also I see you still have lines like
alarme2={};
which should be
alarme2 = ""
That is probably why you are getting Object in the output.

indeed I had forgotten some {}, I modified but it's the same!
"ALERTE : [object Object]"

I declared 4 messages, and here I actually have 3, because the site sends a message if there is an alert (if no alert, it does not send empty content, but nothing (no path) )

do I have to add these?

if (alerte0===undefined ) {
alerte0=""}
}

Yes, or the suggestion I gave earlier which is just to use
if (alert0)
which works because undefined is interpreted as false in a test.
Also expand the alerts in the debug output and check they consist of just the string.

Edit: Just looked back at the debug and the alert is not just a string, you need to extract the event property of the alert.

Here is what I did, but I have the same message in debugging output
(23/12/2020 at 16: 44: 01node: 511f3f71.1a6ec8
msg.payload: string [24]
"ALERT: [object Object]")

let alerte0 
let alerte1
let alerte2 
let alerte3
let alarme1
let alarme2
let alarme3
let alarme4

 alerte0 = msg.payload.alerts[0];
 alerte1 = msg.payload.alerts[1];
 alerte2 = msg.payload.alerts[2];
 alerte3 = msg.payload.alerts[3];
 
 if (alerte0===undefined  ) {
    alerte0=""
}
if (alerte1===undefined  ) {
    alerte1=""
}
if (alerte2===undefined  ) {
    alerte2=""
}
if (alerte3===undefined  ) {
    alerte3=""
}
 
 alarme1 = "";
 alarme2 = "";
 alarme3 = ""; 
 alarme4 = "";
 


if (alerte0=="Moderate rain-flood warning" ||alerte1 =="Moderate rain-flood warning" || alerte2 =="Moderate rain-flood warning" || alerte3 =="Moderate rain-flood warning"){
    alarme1="Pluie"
}
else{ alarme1="";}
if (alerte0=="Moderate wind warning" ||alerte1 =="Moderate wind warning" || alerte2 =="Moderate wind warning" || alerte3 =="Moderate wind warning"){
    alarme2="Vent"
}
else{ alarme2="";}
if (alerte0=="Moderate flooding warning" ||alerte1 =="Moderate flooding warning" || alerte2 =="Moderate flooding warning" || alerte3 =="Moderate flooding warning"){
    alarme3="Inondation"
}
else{ alarme3="";}



if (alarme1==="" && alarme2!==""){
    alarme1=alarme2;
    alarme2="";
}
if (alarme2==="" && alarme3!==""){
    alarme2=alarme3;
    alarme3="";
}
if (alarme3==="" && alarme4!==""){
    alarme3=alarme4;
    alarme4="";
}
    
msg.payload="ALERTE : "+alerte0+alarme2+alarme3+alarme4 ;    

return msg;

You probably missed the edit I made to my previous post.

if i do these

let alerte0 
 alerte0 = msg.payload.alerts[0];
 if (alerte0===undefined  ) {
    alerte0=""
}
msg.payload=alerte0;    
return msg;

I have this output:
23/12/2020 à 16:49:53node: 7b2406e5.684f88

msg.payload : Object

{ sender_name: "METEO-FRANCE", event: "Moderate rain-flood warning", start: 1608705180, end: 1608786000, description: "Although rather usual in this …" }

That is exactly what is expected, from the debug you posted eariler:

yes, I forgot part of the way!

let alerte0 = msg.payload.alerts[0]  ?  mst.payload.alerts[0].event  :  ""

he does not want (: "") there is an error? ?

"TypeError: Cannot read property 'event' of undefined"

I am sure you can work out what the typo I put in the line I posted is, I had mst instead of msg, it should be
let alerte0 = msg.payload.alerts[0] ? msg.payload.alerts[0].event : ""