Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i got this error could someone help me out with it

  • SyntaxError: /project/app/index.js: Invalid left-hand side in assignment expression. (28:4) 26 | console.log(device.modelName); 27 | thing.text = "Open your fitbit app, then go to Account>" + device.modelName + ">Gallery. Then click on this clock face, go to permissions, and select all."; > 28 | if (appbit.permissions.granted("access_heart_rate") = "false") { | ^ 29 | box.style.display("show"); 30 | } 31 | else if (appbit.permissions.granted("access_activity") = "false") {
    • Details: code: PLUGIN_ERROR reasonCode: InvalidLhs pluginCode: BABEL_PARSE_ERROR hook: transform id: /project/app/index.js watchFiles: /project/app/index.js
  • Build failed.

 

Best Answer
0 Votes
3 REPLIES 3

Not = but ==  or ideally ===

I think that permissions return boolean, so I wouldn't use strings for "false", etc.

Your post was hard to read; it would be great if you could format text snippets as code. 🙂

Peter McLennan
Gondwana Software
Best Answer

oh, cool. Thanks!

Best Answer
0 Votes

One of the most common mistakes and hard to find. Never use = in an if-statement. I even avoid it because of this mistake. 

And when an expression is boolean then use if ( !expression) or if (expression).

Community Council MemberMario Dings | Rotterdam NL
Fitbit: Versa, Versa2, Sense. (Versa light) - Phone: Android. - Developer clockfaces.(Nederlands)
Best Answer