by using
function convert(minutes) {
}
How can i change minutes to second
i was trying
function convert(minutes) {
let sec
sec = number(sec)
let minutes = 60 * sec
return()
}
and it doesnt work
so if any one of you know please help me
2
Answers
Your function does not make any sense, as
sec
is not defined and the function itself returnsundefined
.Try it this way:
There are a few problems with your code:
To fix that on the assumption – please clarify this sort of thing in the question – that you want to convert a number of minutes (say,
2
) into seconds (for example120
):JS Fiddle demo.
As an aside, though, I’d strongly suggest you look up some JavaScript tutorials to learn the basics; the errors you present look like you’ve maybe seen, and probably read, some JavaScript but haven’t learned, or retained, enough information about, or understanding of, the language and its uses. This isn’t intended to be offensive, but it’s hard to progress without learning the basics (even if you’re learning as you go).
References:
const
.document.querySelector()
.EventTarget.addEventListener()
.return
.let
.NaN
.Number()
.parseFloat()
.SyntaxError
.