Assuming that you want to see the equivalent to console log printed to stdout, the following will do:
[ "$data" ] && echo "condition satisfied"
or equivalently
test "$data" && echo "condition satisfied"
(the double quotes are needed for the case data contains a space), or, provided you have bash (since you tagged the question for bash and for shell),
[[ $data ]] && echo "condition satisfied"
Here the quotes are not needed.
All variants test whether the variable data contains a non-empty string, and if this is the case, it prints the message.
This is of course not exactly the same as if(data) in JavaScript, because in JavaScript, if data had the value 0, the condition would be considered false. You can emulate this behvaviour in shell too, but it gets more cumbersome.