how to solve the invalid left-hand side assignment?

183 Views Asked by At

i have a function in which there is a error coming in a inspect element it is uncaughtReferenceError:Invalid left-hand side assignment & i'm using buzz.js library for sound so the function is:

function clickedbar(e)
{
  var mouseX=e.pageX-bar.offsetLeft;
  var newtime=mouseX*mysound.getDuration()/240;
  mysound.getTime()=newtime;
  progressbar.style.width=mouseX+'px';
}

I'm getting error in the 3rd line of that function that is "mysound.getTime()=newtime".How i can solve this line of code,all other lines are working fine,please someone help me out of this.

2

There are 2 best solutions below

0
On BEST ANSWER

It looks like Buzz.js library has a setter for this, so instead of:

mysound.getTime() = newtime;

do:

mysound.setTime(newtime);

Based on it's documentation: http://buzz.jaysalvat.com/documentation/sound/

1
On

You are assigning a value to a function call

mysound.getTime()=newtime;

if it is a property then do this

mysound.getTime=newtime;

or is there a setTime method?