I created an object movies and method as follows;
var movies = [
{
aa : "value01"
bb : 6.5
},
{
aa : "value02"
bb : 6
},
{
aa : "value02"
bb : 7.5
},
percentage:function(movieRating, scale){
return (movieRating/scale) * 100;
}
]
Accessing the object and method i tried to use the following approach;
theRating = (movies.percentage(movies[0].bb,10));
But running the script gives me a;
Uncaught SyntaxError: Unexpected token :
Actual code is in https://pastebin.com/9tvrSVJ1
The work around I did is found in https://pastebin.com/LkCwzWXn
Can someone point to me where the first version of the code is wrong.
Thanks in advance.