problem TypeError: $w(...).onViewportEnter is not a function

I write setInterval function on my site
but it’s not working, in consol I have an error: TypeError: $w(…).onViewportEnter is not a function

this is the function:
$w . onReady ( function () {
$w ( ‘#EmploNum’ ). text = ‘0’ ;
countUp ( ‘EmploNum’ , 200 , 10 );

});

function countUp ( elementId , endNum , sec ) {
let i = 0 ;
let intervalDuration = ( sec * 1000 ) / endNum ;

$w ( elementId ). onViewportEnter (( event ) => { 
    setInterval (() => { 
        **if**  ( i  <=  endNum ) { 
            **let**  value  =  String ( '+' ) +  i . toLocaleString (). toString (); 
            $w ( elementId ). text  =  value ; 
            console . log ( value ); 
            i ++; 
        } 
    },  intervalDuration ) 
}) 

}

who can help me?

 $w("#" + elementId).onViewportEnter((

Hello,

 Declare a new var for ViewportEnter & add it to the function  countUp.