I have two input fields and one text field for output. and this is the code I tried
export function spl_click(event) { let spl = Number($w('#spl').value); let distance = Number($w('#distance').value); function getBaseLog(x, y) { return Math.log(y) / Math.log(x); } let answer =(spl-20*(getBaseLog(10, (distance/1))); $w('#text7').text= answer; }
The error is
Hi Velo,
Thank you for the info. The code was copy pasted in between the pictures ;-)
Right! bananas not equal to apple. but consider me as a new born for my silly questions. At the moment bananas and apples looks the same to me 😁
I tried the following and couldn't able to figure it out
$w('#text7).value = answer;
changed the field to number
$w('#input18).value = answer;
what should i use
Well before i start to retype all your code from a pic (which was surely not the aim of my day xD--> next time please use --> CODE in CODE-BLOCK to show your code --> then your code is selectable and a COPY&PASTE is possible).
And someone who tries to help you, can save some time 😉
Well, first try to solve your problem by your own. How?
Take a look onto the suggested informations in the info-panel.
IT'S RECCOMENDED TO USE A NEW VARIABLE, SUCH AS -->
let xxx =
Not sure if this will work, but try to follow the instructions...
Here your return-function....
function getBaseLog (x,y){ return (Math.log(y)/Math.log(x)) }
Now trying the same with...suggested info...
function getBaseLog (x,y){ let mySuggestedVariable1 = x; let mySuggestedVariable2 = y; let myResult = Math.log(y)/Math.log(x) return (myResult) }
let answer = (spl-20*(getBaseLog(10, distance/1))); $w('#text7).text = answer;
But wait! What kind of type is your --> "answer" ??? ---> NUMBER?
console.log(typeof answer) ---> STRING ???
And you try to put a --> NUMBER <-- into a --> TEXT <---
TEXT = STRING ??? / NUMBER = TEXT ??? / STRING=NUMBER???
Already confused? 😁
Bananas are not equal to apples, right? 😉