Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 509825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:03:03+00:00 2026-05-13T07:03:03+00:00

I have a variable that holds a number var simpleNumber = 012345678; I want

  • 0

I have a variable that holds a number

var simpleNumber = 012345678;

I want to .split() this number and create an array that would be of each 3 numbers

the array should look like this

[012, 345, 678]

var splitedArray = simpleNumber.toString().split(/*how do i split this?*/);

it is part of a getRGB(“ffffff”) function, so i cant know what will be passed in.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T07:03:03+00:00Added an answer on May 13, 2026 at 7:03 am

    You can try:

    var splittedArray = "012345678".match(/.../g);
    
    function tridigit(n) {
        return n.toString().match(/.{1,3}/g);
    }
    

    Note that if you prefix a number with a zero, it will be interpreted in octal. Octal literals are officially deprecated, but are supported for the time being. In any case, numbers don’t have leading zeros, so it won’t appear when you convert the number to a string.

    Testing on Safari and FF, numbers with a leading 0 and an 8 or 9 are interpreted in base 10, so octal conversion probably wouldn’t be a problem with your specific example, but it would be a problem in the general case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a private class variable that holds a collection of order items: Private
I have a table (table variable in-fact) that holds several thousand (50k approx) rows
The situation: I have multiple classes that should each hold a variable with a
I have a variable that contains : Sometimes array of strings and sometimes array
I have a short integer variable called s_int that holds value = 2 unsighed
I'm working on a Java/Groovy program. I have a double variable that holds a
I have a variable that holds an angle, in degrees, which can be both
In MATLAB (r2009b) I have a uint32 variable containing the value 2147484101. This number
I have a file txt file that holds 3 values each seperated by a
I have a process that must create and close threads on demand. Each thread

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.