Trim function not working in javascript


#1

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.


#2

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


#3

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