JAvascript nested IF within an IF within an IF [closed]

I am having an issue getting the results I want concerning a nested if. I am accustomed to being able to set an if statement based on a previous if statement. Is this not possible in JavaScript?

I have the following code and am not getting the desired response. I want to set the variable PFF to a string based on several conditions. If the filename has a string in the name then check if a the value of another variable is P/F do something different for each occurrence. Then return to the first if and if is NOT then perform another if and and so on.

I have the code below that I am working with:

            var PFF

            if (file.indexOf('string of file variable') >= 0) {
                if (result_P_F = 'P') {
                    PFF = pVEN + file;
                } else {
                    PFF = fVEN + file;
                }
            } else
            if (CustomerCode = 'A') {
                if (result_P_F = 'P') {
                    if (TYPE = 'X') {
                        PFF = 'p5' + file;
                    } else {
                        PFF = 'p4' + file;
                    }
                } else if (TYPE = 'X') {
                    PFF = 'f5' + file;
                } else {
                    PFF = 'f4' + file;
                }
            }  else
            if (CustomerCode = 'B') { 
                if (result_P_F = 'P') { 
                    if (TYPE = 'X') {
                        PFF = 'pC5' + file;
                    } else {
                        PFF = 'pC4' + file;
                    }
                } else if (TYPE = 'X') {
                        PFF = 'fC5' + file;
                    } else {
                        PFF = 'fC4' + file;
                }
            }

Please let me know your solution.