1289solutions

<web> Your Code has 1289solutions </web>

Tuesday, 23 October 2018

Length of Number in JavaScript

get length of number with out converting to string.



Method 1: 
var x = 1234567;

x.toString().length;

Method 2:
const num = 123456
`${num}`.length // 6


Posted by Abhishek at Tuesday, October 23, 2018
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Do you think it could be useful for you? Share your thoughts with us!

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

know new tip

Abhishek
View my complete profile

Blog Archive

  • ►  2019 (2)
    • ►  April (1)
    • ►  February (1)
  • ▼  2018 (9)
    • ▼  October (5)
      • css selector with attribute value
      • Length of Number in JavaScript
      • detect webview or browser
      • table with fixed td
      • Angular directive that automatically adjusts texta...
    • ►  August (4)
  • ►  2017 (1)
    • ►  January (1)
  • ►  2016 (3)
    • ►  June (2)
    • ►  February (1)
  • ►  2015 (9)
    • ►  November (1)
    • ►  September (1)
    • ►  August (2)
    • ►  June (2)
    • ►  April (2)
    • ►  February (1)
  • ►  2014 (3)
    • ►  October (1)
    • ►  September (1)
    • ►  July (1)
  • ►  2013 (27)
    • ►  November (1)
    • ►  September (6)
    • ►  June (3)
    • ►  May (3)
    • ►  April (1)
    • ►  February (2)
    • ►  January (11)
  • ►  2012 (45)
    • ►  December (22)
    • ►  November (23)
1289solution. Picture Window theme. Powered by Blogger.