About
Pricing
Community
Teams
Start Free Trial
Log in
jecommera
asked on
3/18/2012
how do I cut up a number like 281 in javascript
Hi,
Can someone advise how I would cut up a number like 5000 or 281 in javascript and store into new variables.
thanks
JavaScript
9
4
Last Comment
Proculopsis
8/22/2022 - Mon
Gurvinder Pal Singh
3/18/2012
what do you mean by cut up?
jecommera
3/18/2012
ASKER
So I will have
from 281, I get
a=2, b=8, c=1
SOLUTION
Gurvinder Pal Singh
3/18/2012
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
jecommera
3/18/2012
ASKER
Can you please explain the code.
thanks for your help
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Gurvinder Pal Singh
3/18/2012
i am simply removing the last digit the from variable in every iteration of the while loop and storing that last digit in the digits array
Kindly tell me if it works or not
jecommera
3/18/2012
ASKER
Yes it works - I just trying to understand your code here.
Why did you use 10 here?
digits[ digits.length ] = val%10;
val = val /10;
ASKER CERTIFIED SOLUTION
Gregg
3/18/2012
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
nap0leon
3/18/2012
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Proculopsis
3/18/2012
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.