Code Monkey home page Code Monkey logo

kc-web-cw-7's Introduction

اليوم راح نحسب مؤشر وزن الجسم أو الـ BMI 📏!

جاااهزييين؟ 😍

  1. قم بعمل fork للـ repository
  2. افتح الـ repository باستخدام github desktop
  3. افتح ملف script.js لتبدأ بالحل
  4. عرف دالة باسم BMI وتستقبل معاملين (weight, height)
    • استخدم المعادلة التالية لحساب الـ BMI، ثم قم بحفظ الناتج في متغير باسم result:
      weight / (height * height)
    • أرجِع result باستخدام كلمة return
  5. قم بمناداة الدالة BMI داخل console.log ولا تنسَ كتابة المعاملات
    مساعدة: ((أدخل المعاملات هنا)BMI)console.log
  6. عرف دالة مرجعة باسم Status والتي ستستقبل المعامل BodyMass , وترجع لنا قيمة طبقاً للمقياس التالي (return):
    مساعدة: ستستخدم الجملة الشرطية if
return BodyMass
"لديك نقص في الوزن"أقل من 18.5
"وزنك صحي"أكبر من أو يساوي 18.5 وأصغر من 25
"لديك زيادة في الوزن"أكبر من أو يساوي 25

  1. عرف دالة باسم calculate لتقوم بتنفيذ الخطوات التالية عند مناداتها:
    • احفظ قيمة الوزن التي يدخلها المستخدم في حقل الإدخال في متغير باسم weight
      مساعدة: let weight = document.getElementById(...).value
    • احفظ قيمة الطول التي يدخلها المستخدم في حقل الإدخال في متغير باسم height
      مساعدة: let height = document.getElementById(...).value
    • عرّف متغير باسم bmi_value قيمته هي الدالة ()BMI، ولا تنسَ استخدام الـweight والـheight في معاملات الدالة
      مساعدة:()let bmi_value = BMI
    • عرّف متغير باسم desc قيمته هي الدالة ()Status، ولا تنسَ استخدام المتغير bmi_value الذي أنشأته في الخطوة السابقة كمعامل للدالة Status
      مساعدة: (bmi_value)let desc = Status
    • عرّف متغير باسم box واجعل قيمته هي الوسم الذي يحمل هوية result طبقاً للمساعدة أدناه
      مساعدة: let box = document.getElementById('result')
    • غير النص الداخلي للمتغير box باستخدام innerText واجعل قيمته كالآتي:
      bmi_value + " == " + desc
      مساعدة: box.innerText = bmi_value + " == " + desc
  2. أضف حدث onclick إلى الزر ليستدعِ دالة calculate
  3. احفظ التغييرات وارفع الكود إلى github
  4. قم بتسليم التمرين في موقع Coded lab

بونص! ✨

  • قم بكتابة معاملات افتراضية للدالة ()BMI، وكرر الخطوة 5 بدون معاملات!
  • قم باستخدام حدث onmouseover بدلاً من onclick في الخطوة 8
  • قم بالتعبير عن كل حالة من الحالات الموجودة في الجدول بتغيير لون النص، مثلاً:
    • لديك نقص في الوزن <- باللون البرتقالي
    • وزنك صحي <- باللون الأخضر
    • لديك زيادة في الوزن <- باللون الأحمر

"لا تترددون بسؤال المدرسين 👌"

kc-web-cw-7's People

Contributors

anasmeshal avatar fatmaboodai avatar mbuzlouf avatar nancyelsh avatar waliiidals avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.