Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js pad 2

function pad2(n) {
  return (n < 10 ? '0' : '') + n; 
}
alert(pad2(3)); //03
alert(pad2(12)); //12
Comment

PREVIOUS NEXT
Code Example
Javascript :: data type in javascript 
Javascript :: copy to clipboard 
Javascript :: javascript declare a variable 
Javascript :: "SyntaxError: Unexpected token o in JSON at position 1 
Javascript :: convert mongodb timestamp to date javascript 
Javascript :: input type styled components 
Javascript :: read excel file through nodejs 
Javascript :: react-native razorpay 
Javascript :: date range filter 
Javascript :: javascript print 
Javascript :: refresh page by hand in react 
Javascript :: jquery each response 
Javascript :: vuex state from another module 
Javascript :: Radom String in Javascript 
Javascript :: how to implement redis pub sub model using nodejs 
Javascript :: firebase timestamp to date angular 
Javascript :: displaying the date react 
Javascript :: percentage formula in javascript 
Javascript :: javascript toisostring without milliseconds 
Javascript :: ternaire js 
Javascript :: javascript hours minutes seconds 
Javascript :: How to replace a value in localstorage using javascript 
Javascript :: how to add a class to an element in javascript 
Javascript :: number_format in jquery 
Javascript :: hmac_sha256 node 
Javascript :: update data firestore 
Javascript :: duplicate numbers in an array javascript 
Javascript :: jquery is element hidden 
Javascript :: change p text jqwuery 
Javascript :: javascript sleep 1 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =