Reference Error when converting Unity code to PlayCanvas

I found two threads on PC forums about this Head Bobbing effect subject and in both of them PC moderators direct the user to a Unity tutorial link and they say the logic is the same in JS with C#. Here:

I’m not trying to blame anybody here but don’t you think it’s kind of misleading and confusing to say someone to "This is similar to Unity, just look at this Unity tutorial and try it on JS"then saying “JS&Play Canvas don’t operate like Unity&C#, you need to know both languages well to work this out.” Again i’m not blaming you or anybody here, but please don’t direct people to Unity tutorials on these forums again. Just direct them to a Java Script&Play Canvas source so they don’t waste time trying to convert a C# script to JS like me. Or just say we don’t know how to do it. I hope you see my point here.

“While I can quickly do that for you, it’s not going to help you in the long run when you write your next script etc and unfortunately, I can’t spend that time going step by step with you.” I’m well aware of that and respect that. I never expected for you to do it in the first place.

Thanks again for the support and the time you spent for me, i appreciate it sincerely