Simply ignore the var
keyword.
function testFunc() {
testVar = 1; // `testVar` is a Global variable now
}
Note: In the Python version of your code, you are not defining a global variable. You are referring the variable testVar
defined in the global scope.
Quoting from var
MDN Docs,
assigning a value to an undeclared variable implicitly declares it as a global variable (it is now a property of the global object)