1
if(clientId) var url = BASE_URL+'/projects/task-filter/?client='+clientId+'&offset=0';
  else var url = BASE_URL+'/projects/tasks/?user='+userId+'&offset=0';

what should i write in the code if the condition is to check the clientId is a number.have any built function to check the variale is numer or not

sony johns
  • 98
  • 1
  • 10
  • 5
    Possible duplicate of [How to check if a variable is an integer in JavaScript?](https://stackoverflow.com/questions/14636536/how-to-check-if-a-variable-is-an-integer-in-javascript) – Nico Haase May 18 '18 at 07:11

1 Answers1

1

You can refer the link https://www.mkyong.com/javascript/check-if-variable-is-a-number-in-javascript/

var url = isNaN(clientId) ? BASE_URL+'/projects/task-filter/?client='+clientId+'&offset=0' : BASE_URL+'/projects/tasks/?user='+userId+'&offset=0' 
Prabhu
  • 1,057
  • 7
  • 13