-->
Page 1 of 1

HOW TO EXCHANGE VARIABLES BETWEEN BASIC AND JAVASCRIPT??

PostPosted: Sat Sep 11, 2021 5:15 am
by alfredkeen
I am trying to do the following

In basic I have a variable let's say x

How do I access that variable with Javascript
let javascript perform some actions on it applinked
let Basic get the result back from javascript

Any ideas ???
Any example please

Re: HOW TO EXCHANGE VARIABLES BETWEEN BASIC AND JAVASCRIPT??

PostPosted: Sun Dec 05, 2021 10:54 pm
by loyalwar
hi, Recently I read a post have some ways to fix error like you, I think it maybe good you can try:
- Destructuring assignment (a feature of ES2015) lets you extract items of an array into variables. For example, the following code destructures an array:
let a;
let b;
[a, b] = [1, 2, 3];
a; // => 1
b; // => 2
- Or Temporary variable: Swapping variables using a temporary variable is classic. As the name suggests, this approach requires an additional temporary variable.Let's swap the values of variables a and b using a temporary variable temp:
let a = 1;
let b = 2;
let temp;
temp = a;
a = b;
b = temp;
a; // => 2
b; // => 1