Asalam Alikum |
---|
Greetings Everyone! I hope everyone is enjoying their life with family and friends by the Grace of Allah Almighty. Last week of this season has started and I am doing my homework for this week. The topic of this week is Data Type and Conditional Statement which was decided by Professor @starrchris. So lets start homework step by step.
Homework
Create a Fibonacci series using the JavaScript loop. |
---|
For Fibonacci series I created an input field where a user will input number up to where he wants this series to show result. Actually Fibonacci series is an infinite series which starts from 0 and 1. In this series, every next number is the sum of previous two numbers. You will better understand it with example below. I will share all in a video as well in the end.
Code
Output
Write a JavaScript program that generate the average marks of the students. Then, this average is used to determine the student grade based on the criterias listed |
---|
I have done this with predefined values of Students marks and grades. But we can do it in different way as well which I will show you in the last video Output. We can even input values and then it will calculate average score and grade.
Code
Output
Create a function that would solve addition, subtraction, division, multiplication. With 3 parameters. |
---|
Code
Output
Create object for 5 steemians with username, rep, country, position held on steemit properties. |
---|
Here I created objects for 5 Steemians and then use display function for 2 properties username and country as it is said in the assignment. I will add this to the final layout as well.
Code
Output
Why do we need Conditional statement and how do we use them? |
---|
Conditional statments are important in programming because they they allow our code to make decisions and execute different code paths based on specific conditions. These statements help us to handle various scenarios dynamically instead of following the predetermined path.
Why We Need Conditional Statements
- Conditional statements help our program decide which actions to perform based on different inputs or states.
- You can use conditional statements to check for errors or invalid conditions and respond accordingly.
- It allows our code to adapt to different situations and handle various cases which makes it more responsive and versatile.
- Conditional statements help in optimizing code execution by skipping unnecessary operations based on conditions.
Types of Conditional Statements
- 'if' statement
- 'if...else' statement
- 'else if' statement
- 'switch' statement
Example Code
Example Output
Adding All Features to Webpage
HTML
CSS
Javascript
Output Video
Thank You For Reading
Achievement 1
This is all from me for the "SEC S19W6 || Data Type and Conditional Statement" I invite @hudamalik20, @paholags, and @abdullahw2 to participate in this HTML5CSS3 Lesson.
You have explained in a good way. And the video which is explaining each task is also nicely recorded. The use of html, CSS and JavaScript and their integration with each other is nicely done.
You are right conditional statements really help us a lot to perform the decision making. We can control the blocks of code in an efficient way.
Best of luck 🤞.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Thank you, friend!
I'm @steem.history, who is steem witness.
Thank you for witnessvoting for me.
please click it!
(Go to https://steemit.com/~witnesses and type fbslo at the bottom of the page)
The weight is reduced because of the lack of Voting Power. If you vote for me as a witness, you can get my little vote.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Upvoted. Thank You for sending some of your rewards to @null. It will make Steem stronger.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Wa Alaikum Assalam great job on this post you explained the Fibonacci series and student grading program was clear and easy to understand.
I also liked your explanation of conditional statements and how they help in making decisions in code. Your examples made the concepts very accessible.,wish you success 💖🤗🌸💐
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Greetings too dear friend hope you will be fine. Your work is great and perform every task very well. All the functions work and the video presentation make the better understanding. I wish you more success.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit