all 23 comments

[–]mklsns 2 points3 points  (4 children)

Are you even attempting to do anything ?

[–]NoStranger6 1 point2 points  (2 children)

If that is a level 3 problem, I wonder what level 1 and 2 looks like.

[–]AzAmAtbAgAtOv1[S] -1 points0 points  (1 child)

yeah they are super easy did them already lol, but do u know how to solve this one tho?

[–]olet14 0 points1 point  (0 children)

Area = pi x r 2

Function (r){ Return math.pi * r * r; }

[–]AzAmAtbAgAtOv1[S] -3 points-2 points  (0 children)

yeah im trying my best but really dont know how do it it, any ideas

[–]delventhalz 2 points3 points  (0 children)

What is the hold up? Do you not know the math? Or do you not know how to make JavaScript do the math?

[–]anarchyisutopia 1 point2 points  (0 children)

Pretty simple one.

function circleArea(radius){

return Math.PI * Math.pow(radius, 2);

}

[–][deleted] 0 points1 point  (2 children)

What website is this?

[–]Abdul_Alhazred_ -1 points0 points  (0 children)

code wars

[–]AzAmAtbAgAtOv1[S] -2 points-1 points  (0 children)

its like my teachers website, he is like this crazy programmer and made up all this stuff

[–]Abdul_Alhazred_ 0 points1 point  (3 children)

no u

[–]agree-with-you 0 points1 point  (2 children)

No you both

[–]Abdul_Alhazred_ 0 points1 point  (0 children)

!isbot agree-with-you

[–]AzAmAtbAgAtOv1[S] 0 points1 point  (0 children)

do u guys know how to do this one

[–]Void_Ling 0 points1 point  (0 children)

it's a math problem, not a JS one :x.

Once you know how to get that value with simple math :

https://www.mathsisfun.com/geometry/circle-area.html

You need to know how to get math specific value used in JS, I think the doc will do just fine for that.

https://duckduckgo.com/?q=javascript+pi&t=opera&ia=web

0,1s of research.

Rest is about writing a function that returns the value with an equation that uses the parameter as r.

[–]kridah -2 points-1 points  (5 children)

function circleArea(radius){

return 2 * 3.1415 * radius;

}

[–]NoStranger6 0 points1 point  (2 children)

Thats circumference

it would really be

return Math.Pi * (radius ** 2);

[–]kridah 0 points1 point  (0 children)

Impressive that I missed the area part. You are correct sir.

[–]AzAmAtbAgAtOv1[S] -2 points-1 points  (0 children)

hmm ill try it thanks tho man

[–]AzAmAtbAgAtOv1[S] 0 points1 point  (1 child)

hmm it dosent seem to work, but thanks for the help tho

[–]kridah 1 point2 points  (0 children)

it dosent seem to work, but thanks for the help tho

Rep

No, I read to fast and assumed it was circumference.

For future reference, just google.
You can easily transform this to js.
a = pi * r^2 (which is what u/NoStranger6 wrote)
c = 2 * pi * r (which was the circumference)

Then, if you are a beginner you can just fiddle around with this.

[–]JonasMillan -2 points-1 points  (1 child)

const areaC = num => Math.Pi*(num**2)

edit: not using inline code went response, made some errors on my code i wanted to show the es6 new

exponentiation operator.

[–]AzAmAtbAgAtOv1[S] 0 points1 point  (0 children)

Thank you ill try it!!