Can someone help me fix my function

I have a object like this :

 this.job_type= 

  {"":"Select job type","P":"Part-time","C":"Contract","T":"Temporary","O":"Other","V":"Not Applicable"}

and I called it in a controller like this:

 $scope.workType=function (type) {
    var data=dataShare.job_type
    var answer=""
    
    angular.forEach (data, function (value, key)
    {
      if (type = key)
      {
        answer=value
      }

    })
     return answer; 
    console.log (answer)
  } 

all I want to do is return the value but all i get is a result saying ‘not applicable’ r

Please post a codepen or a plunker

well I wasn’t sure how to make it work but here

If job_type is available in the scope

Rather than use a function

{{job_type["P"] || 'NOT FOUND'}}

or

   $scope.workType = function(type) {
      var data= $scope.job_type;
      for(var key in data){
        if(key = type){
          return data[key]
        }
      }
      return "NOT FOUND"; 
    }

Both have the same output