Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
学ぶ Challenge: Fixing the Speed Function | Section
JavaScript Fundamentals
セクション 1.  48
single

single

bookChallenge: Fixing the Speed Function

メニューを表示するにはスワイプしてください

タスク

スワイプしてコーディングを開始

Previously, you created a calcSpeed function that calculated the speed of a car using fixed values inside the function. Now you need to improve the function so that it can accept values from outside.

Your tasks:

  1. Remove the local variables distance and timeTaken from inside the function.
  2. Add two parameters named distance and timeTaken in the function definition.
  3. Calculate the speed using the formula:
    Speed = Distance / Time Taken
    
  4. Return the calculated speed.
  5. Call the function twice using the following arguments:
    • 1000, 120
    • 1200, 160

解答

Switch to desktop実践的な練習のためにデスクトップに切り替える下記のオプションのいずれかを利用して、現在の場所から続行する
すべて明確でしたか?

どのように改善できますか?

フィードバックありがとうございます!

セクション 1.  48
single

single

AIに質問する

expand

AIに質問する

ChatGPT

何でも質問するか、提案された質問の1つを試してチャットを始めてください

some-alt