how to get result directly in javascript [closed]

I want get report status from td status directly. So, if user input the result then report status will update too from status.

if one of status get value fail then report status will get value fail too although one of status get value pass.

This is the picture

Here’s the javascript

  <script>
            function hitung_status()
            {
                var pass = document.querySelectorAll('[name="status_hidden[]"]')[0].value == 'pass';
                var fail = document.querySelectorAll('[name="status_hidden[]"]')[0].value == 'fail';

                if (fail >= 1){
                    document.querySelector('[name="result_status"]').value = 'fail';
                    console.log('fail');
                }else{
                    document.querySelector('[name="result_status"]').value = 'pass';
                    console.log('pass');
                }
            }
        </script>

Thank you