Shikhar Srivastava
Shikhar Srivastava

Reputation: 149

how to solve the invalid left-hand side assignment?

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.

Upvotes: 0

Views: 172

Answers (2)

Arber Sylejmani
Arber Sylejmani

Reputation: 2108

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/

Upvotes: 4

Dave Pile
Dave Pile

Reputation: 5764

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?

Upvotes: 2

Related Questions