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 7411453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:23:20+00:00 2026-05-29T06:23:20+00:00

I have the following code; var looptijd_1 = de_snelheid * de_afstand; var split_looptijden_1 =

  • 0

I have the following code;

var looptijd_1 = de_snelheid * de_afstand;
var split_looptijden_1 = new Array();
split_looptijden_1 = looptijd_1.split('.');

As you can see, is the idea very simple. I want to split an number by its dot. So if the number is 69.07, i want an variable with 69 and an variable with 07.

I know I have to make a string of the variable and split them, but I need the 07 as 07 and not 7 (because I’ve got the do some math with it).

I know that I can take the first value, and store that, then the variable – the stored variable, so I’ve got 0.07, but I hope there’s an better way tho achieve this, because this needs to be done 12 times on the page.

Is there a better way to achieve my goal (variable1 = 69; variable2=07) and both integers?

EDIT;
The whole point, is that this is math about walking time… And there are none constant variables, so i lop them, and then i would like to do the trick (numbers after the dot * 60)

  • 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-29T06:23:21+00:00Added an answer on May 29, 2026 at 6:23 am

    If you’re wanting to perform calculations with the results then there’s no need to convert your number to a string, split it, and then convert the resulting strings back to numbers. Use some basic maths instead:

    var split_looptijden_1 =
        [
            (looptijd_1 > 0) ? Math.floor(looptijd_1) : Math.ceil(looptijd_1),
            looptijd_1 % 1
        ];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: var numberOfSelectedOptions = new Array(); numberOfSelectedOptions[0]=0; numberOfSelectedOptions[1]=0; numberOfSelectedOptions[2]=0; $(a.tagvariantoption).live(click,
I have the following code: var intrebari = new Array(); var i = 0;
I have the following code: var ids = new Array(5); $(function(){ html5sql.process(sql, function(transaction, results,
I have the following code in specman: var x := some.very.long.path.to.a.variable.in.another.struct; while (x ==
I have the following code: var commitmentItems = new List<CommitmentItem<ITransaction>>(); commitmentItems.Add(new CapitalCallCommitmentItem()); And I
I have the following code: var words = new Object(); $(li.words).each(function(){ var thisId =
I have the following code var section = new CustomConfigurationSection(); section.SectionInformation.Type = System.Configuration.NameValueFileSectionHandler; section.SectionInformation.SetRawXml(sectionXml);
I have the following code: var tf:TextFormat = new TextFormat(); tf.font = arial; aRButton.textField.antiAliasType
I have the following code: var items = new List<string> {1, 2, 3}; //
I have the following code: var XmlDoc = new XmlDocument(); Console.WriteLine(); Console.WriteLine(response.ReadToEnd()); Console.WriteLine(); //

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.