Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

check if number is single digit javascript

function hasOneDigit(val) {
  return String(Math.abs(val)).charAt(0) == val;
}
console.log(hasOneDigit(1)); // true
console.log(hasOneDigit(12)); // false
Comment

PREVIOUS NEXT
Code Example
Javascript :: toggle class javascript and jquery 
Javascript :: how to make slide js in owl carousel auto 
Javascript :: js change button text 
Javascript :: copy to clipboard react native 
Javascript :: add property to string js 
Javascript :: ascending and descending val in array using js 
Javascript :: guid generator node 
Javascript :: jquery append 
Javascript :: jquery change text color 
Javascript :: js open window in new tab 
Javascript :: js check if two array have the same element 
Javascript :: use regex to get urls from string 
Javascript :: js close window 
Javascript :: how to make jtextarea scrollable 
Javascript :: random number in range js 
Javascript :: attr hidden to show jquery 
Javascript :: select add option js 
Javascript :: add variable numerically in javascript 
Javascript :: json get key 
Javascript :: react-select dropdown open inside modal 
Javascript :: mongoose generate objectid 
Javascript :: select remove option jquery 
Javascript :: regex on input 
Javascript :: sum row values in datatable jquery 
Javascript :: un hover in jquery 
Javascript :: javascript convert minutes to hh mm 
Javascript :: check if string is datestring javascript 
Javascript :: sum of numbers array using for loop in javascript 
Javascript :: keypress javascript 
Javascript :: check if localstorage key exists js 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =