I'm working with some older code in AngularJs.  There's a variable someVar1 that could possibly exist in the JS ether and if it does, I wanted to attach it to my scope like so:
$scope.someVar2 = someVar1 || 0;
But occasionally, when someVar1 doesn't exist in the ether, I get this error:
Error: someVar1 is not defined
It points directly to the line and column of someVar1 in the JS file.
Why is this happening?  I was under the impression that someVar1 || 0 would check if someVar1 was undefined, which is falsy, and set the $scope.someVar2 to 0.
 
     
    