Beginner needs help

Hello, i'm just starting on nodered and I have a problem. I'm creating a custom node but can't get the js file to work. In my html file i have this :

<div class="form-row">
    <input type="text" id="node-input-finalMsg" name="Message Final"/>
</div>

And in my js file :

module.exports = function (RED) {
    function AffichageNode(config) {
        RED.nodes.createNode(this, config);
        var node = this;
        this.finalMsg = config.finalMsg;
        this.on('input', function () {
            console.log(node.finalMsg)
        });
    }
    RED.nodes.registerType("Affichage", AffichageNode);
}

But if i run this code I get an "undefined" in the console. can someone help?

Is that your entire html file?

Its missing the <script> parts ( see https://nodered.org/docs/creating-nodes/node-html)

As you want to take something from the configuration part you should also look at the "Configuration Nodes" page. https://nodered.org/docs/creating-nodes/config-nodes

this is a sample, not the entire html, here my html file complete

<script type="text/javascript">
//stuff
    RED.nodes.registerType('Affichage', {
        category: 'Gertrude',
        color: '#91db85',
        defaults: {
            name: { value: "" }
        },
        inputs: 1,
        outputs: 1,
        icon: "affichage.png",
        label: function () {
            return this.name || "Affichage";
        },     
        oneditprepare: function() {
            //stuff
        },
        oneditcancel: function(){
           //stuff
        },
        oneditsave: function(){
            //stuff                   
        }
    });
</script>

<script type="text/x-red" data-template-name="Affichage">
//html here
 <div class="form-row">
    <input type="text" id="node-input-finalMsg" name="Message Final"/>
</div>
</script>

<script type="text/x-red" data-help-name="Affichage">
</script>

You need to include finalMsg in the defaults object so the editor knows this is a property to save to the node configuration.

RED.nodes.registerType('Affichage', {
        category: 'Gertrude',
        color: '#91db85',
        defaults: {
            finalMsg: { value: ""},
            name: { value: "" }
        },
        inputs: 1,
        outputs: 1,
        icon: "affichage.png",
        label: function () {
            return this.name || "Affichage";
        },

This is what I did and I still get the undefined