Errors BCE0043 & BCE0044 when making car move!

I’m a beginner in scripting with c#/javascript. However, I mainly use Javascript.
I am trying to make a car simply move,But when I was confident that my code was correctly displayed without errors for my car game,
this came up:

Assets/Quickscripts/CarControl.js(9,14): BCE0044: expecting ), found ‘=’.


Assets/Quickscripts/CarControl.js(9,14): BCE0043: Unexpected token: true.

Here is my script:

(Please note that I am not done with my script and I am just trying to fix the part that I am confused on.)

//Signals the car to go forward if true
var forward = false;
//Signals the car to go reverse if true
var reverse = false;
function update() {
if(Input.GetKeyDown ("w")) {
    forward = true;
}
if(forward = true) {

transform.Translate(Vector3.forward * Time.deltaTime);

}
}

And with many other scripts has this happened to me! Please help me

The error message actually gives you the line in error. The message contains two numbers (9,14). This means the error is at line 9 and position 14. The issue is the logic check within your if statement, replace the single = with a ==.

 if(forward == true) {

Also, typically for boolean variables you can simply say:

 if(forward) {