eval JavaScript function works only when copied, pasted and run first in Developer console using chrome Developer tools

: i have a function

function myfunc() {
    var SS1 = 16;
    AA = [0,1,2,3,4];
    AA[i] = 1,
    AA[x] = 2,
    console.log(AA[i])
}

if i do

eval(myfunc.toString().replace('SS1', 'SS2')); 

nothing happens , unless i copy the function, paste it in console and run it 1st, then value will change.

any idea how to fix that.

for now i have a snippet :

eval(myfunc.toString().replace('SS1', 'SS2')); 
myfunc ;

this prints the function in console, i click on it, copy it from source where it displays when clicked on, paste it in console, then run the snippet again, it changes values.