php isset in javascript
The equivalent of isset($data) in JavaScript would be to check if the variable is defined and not null.
In JavaScript, you can use the typeof operator to check if a variable is defined and !== null to check if it is not null.
Here's an example of how you could do it:
<script>
if (typeof data !== 'undefined' && data !== null) {
console.log("data variable has some data "+data);
}else{
console.log("No Data");
}
</script>
This will first check if the data variable is defined, and then check if it is not null. If both conditions are true, the code block inside the if statement will be executed.