I’m new beginner in react-native and JavaScript here, i am using a if-else condition.
i want to check the first the condition is correct if it’s correct then it will works in a different different function.
Here is my codes:
const ab = true;
let x;
if (ab === false){
// i want here to stop passing value of x;
//write a code so that x value can't be passed to console.log(x).
}
else if (ab=== true){
x= [1,2,3]
}
console.log(x);
only when ab equals true, x value able to use.
anyone can help me to write a codes for if statement where it will stop to passing values when the condition is correct.
Thanks for your trying in advance!
2
Answers
Basically i wanted to try stop to pass value with a condition but later i tried only one condition and it was worked.
suppose,
so in there if ab is true only that time it will give x values otherwise automatically it will stop. Thanks
I’m also new beginner in JavaScript.
maybe you can do like this:
or like this: