Program for check if a number is positive or negative using JavaScript

preview_player
Показать описание
In this short and informative video, we demonstrate how to write a simple JavaScript program to check whether a given number is positive or negative. Understanding this basic logic is essential for learning programming. The video provides step-by-step instructions in a clear and beginner-friendly way.

#JavaScriptTutorial #PositiveOrNegative #CodingForBeginners #LearnJavaScript #SantoshKumarYadav

JavaScript program to check positive or negative, beginner JavaScript tutorial, learn JavaScript coding, if-else in JavaScript, conditional statements, JavaScript basics, check number type program.
Рекомендации по теме
Комментарии
Автор

<html>

<head>
<title>Positive Negative</title>
<style>
body {
height: 90vh;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
font-size: 3rem;
color: blueviolet;
gap: 2rem;
}

button {
height: 50px;
width: 300px;
background-color: #97cdef;
font-size: 23px;
border-radius: 1rem;
}

input {
height: 50px;
width: 300px;
background-color: #69dea4;
color: blueviolet;
font-size: 23px;
border-radius: 1rem;
}

p {
font-size: 3rem;
color: blueviolet;
}
</style>
</head>

<body>
<p>Programe for check if a number is positive or negative </p>
<input type="text" id="num" placeholder="Enter Your Number">
<button onclick="number()"> Check Number</button>
<p id="res"></p>

</body>
<script>
function number() {
let newVal =

if (newVal > 0) {
= "Positive Number"

} else if (newVal < 0) {
= "Nigative Number"

} else if (newVal == 0) {
= "Zero"

} else {
= "Invalid Number"
}
}
</script>

</html>

coding_with_santosh
visit shbcf.ru