There are two scopes: $scope.job
and $scope.jobs
.
I also have a variable called job;
If $scope.job
is undefined, I want $scope.jobs
to be assigned to the job
variable using the following code: var job = $scope.jobs
. However, if $scope.job
is defined, then I want to assign it to that variable too.
if ( $scope.job ) {
var job = $scope.job;
} else {
var job = $scope.jobs;
}
But in shorthand notation: