Copyright © https://mongoose-os.com

Mongoose OS Forum

frame

Javascript function definitation

Could someone clarify what way I create re-usable function in Javascript

I've had success using the following prototype

    let checkDoor = function(pin){
        print('checking pin', pin);
         let value = GPIO.read(pin); 
       print('Value =',value pin);
     }

vs the normal javascript way.

function cheekDoor (pin){
    print('checking pin', pin);
     let value = GPIO.read(pin); 
   print('Value =',value pin);
 }

Should both methods work?

Sign In or Register to comment.