Trim function not working in javascript


I have this code that gets my the value of phone from my observable linked to a field in XML file. This code works,
var phoneNumber = signupVM.get("signupVal").phone;

but this doesn’t
var phoneNumber = trim(signupVM.get("signupVal").phone);

I have to remove whitespaces which some keyboards adds by default.


Please go through the basics of JavaScript, trim is not a global function but a method in a string instance.


Oops. Sorry about that. That was the php function trim(). Languages are getting squashed in my head.