TypeError: $w(...).onReady is not a function displays when I try adding ratings to my website


I am trying to add ratings field into my website, but when I preview to test the code, this error message pops out. I was using the tutorial explaining how to insert the code when adding ratings on the website, but seems not to be working.

here is the code itself

Anyone has an idea what am I doing wrong here?
Thank you,

You should use dataset into $w.onReady functions

$w.onReady(() => {
  $w('#dataset1').onReady(() => {
    // your code

Any operations with $w selector always must to be into $w.onReady function.