- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Converting km per hour to cm per second using JavaScript
Problem
We are required to write a JavaScript function that takes in a number that specifies speed in kmph and it should return the equivalent speed in cm/s.
Example
Following is the code −
const kmph = 12; const convertSpeed = (kmph) => { const secsInHour = 3600; const centimetersInKilometers = 100000; const speed = Math.floor((kmph * centimetersInKilometers) / secsInHour); return `Equivalent in cmps is: ${speed}`; }; console.log(convertSpeed(kmph));
Output
Equivalent in cmps is: 333
- Related Articles
- Find the ratio of 50 km per hour to 30 m per second.
- A scooterist covers a distance of 3 kilometres in 5 minutes. Calculate his speed in:(a) centimetres per second (cm/s)(b) metres per second (m/s) (c) kilometres per hour (km/h)
- Converting miles per gallon to kilometer per liter in JavaScript
- Converting 12 hour format time to 24 hour format in JavaScript
- A car acquires a velocity of 72 km per hour in 10 seconds starting from rest. Find the average velocity.
- How can I count visitors per page per day using MySQL?
- Which of the following is moving faster? Justify your answeri. A scooter moving with a speed of 300 m per minute.ii. A car moving with a speed of 36 km per hour.
- An aeroplane leaves an airport and flies due north at a speed of 1000 km per hour. At the same time, another aeroplane leaves the same airport and flies due west at a speed of 1200 km per hour. How far apart will be the two planes after $1frac{1}{2}$ hours?
- From a tap of inner radius $0.75 cm$, water flows at the rate of $7 m$ per second. Find the volume in litres of water delivered by the pipe in one hour.
- 1 Hz is equal to$(a)$. 1 vibration per minute$(b)$. 10 vibrations per minute$(c)$. 60 vibrations per minute$(d)$. 600 vibrations per minute
- If 20 waves are produced per second, what is the frequency in hertz?
- Find the length of a platform in metres which a woman crosses at a speed of 60 km per hour in $frac{5}{2}$ minutes.
- A train starting from stationary position and moving with uniform acceleration attains a speed of 36 km per hour in 10 minutes. Find its acceleration.
- Converting numbers to Indian currency using JavaScript
- An aircraft travelling at $600 km/h$ accelerates steadily at $10 km/h$ per second. Taking the speed of sound as $1100 km/h$ at the aircraft’s altitude, how long will it take to reach the ‘sound barrier’ ?

Advertisements