javascript how to do if else

Solutions on MaxInterview for javascript how to do if else by the best coders in the world

showing results for - "javascript how to do if else"
Vihan
08 Jan 2019
1If - Else Statements
2if (condition) {
3// what to do if condition is met
4} else {
5// what to do if condition is not met
6}
7
Stefania
22 Jan 2017
1let a = 1;
2let b = 2;
3if(a == 1 && b ==2){
4	// Code here 
5}
Allison
22 Jul 2020
1if (condition1) {
2  //  block of code to be executed if condition1 is true
3} else if (condition2) {
4  //  block of code to be executed if the condition1 is false and condition2 is true
5} else {
6  //  block of code to be executed if the condition1 is false and condition2 is false
7}
Lyna
22 Jan 2018
1if (condition1) {
2  //  block of code to be executed if condition1 is true
3} else {
4  //  block of code to be executed if the condition1 is false
5}
Amir
03 Nov 2019
1if ( x > 10 )
2{
3cout << "x is greater than 10";
4}
5else
6{
7cout << "x is less than 10";
8}
queries leading to this page
if elseif else condition in best javascriptjavascript if valeuejavascript if thenelse ifjs and ifif elseif javascriptelse statement in javascriptelse javascriptif else statemnets in java scriptif statement syntax in jsif statement js orhow to use else if in java scriptif statement jsjavascript else fw3school for if condition in javascript 22else if 22 statement jsjavascript ifisif statement node jsif else javascriptjava script if statmentjavascript if statementdsyntax for if condition in javascriptjs if loop 5belse statementsif else in node jsjavascript if statementelse if in jqueryif else if examplejs es6 if else if elsew3schools js if statementif else statements in javascriptes6 if statementelif statement javascriptelse and if with objects javascriptjs how to ifnode js if else ifjavascript or conditionif in javascriptcall an html in an else statement in javascripthow to write else if statments in javascriptjavascript 23if what is itif syntax javascript 27js ifesjavascript if andif javascript orif else javascript es6if statement javascript wiyth 21 21check or condition in javascriptif and else javascriptjavascript how to construct if elseand condition in javascriptif js andif 2felse javascripthow to use if else in javascriptif then jshow to create if statements in javascriptif javascript 3f if statment jsif else if jsif else js es6writing an if statement in javascripthow to make a if javascriptif 28 29 javascriptjavascript function ifjs if condition for functionnode js var if elseif if else javascriptif condition javascriptnew if statement jsif 2felse statement javascriptand in the if statement javascriptif statement example javascript 3d 3d 3d in if statement javascriptcall function method with if statement javascriptjavascript if conition with andhow to implement if statement in java scriptif 3a syntax javascriptelse if 28 29 node js 3a 3f if condition jsjavascript elseif vs else ifif with 3f 3a jsis else if in javascripthow do i make if statement in javascriptjava script nested contions w3schoolsjs if 3f 3fif else if javascriptnew if statement javascriptdo if statements need an else in jsjs or ifhow to declare javascript if statementselecting image in if loop jsjs or condition in ifjs else 28 29javascript if syntaxjavascript if and 2for statementif syntax jsjavascript or in if statementif else js syntaxif else with 3f 3a in jshow to write if else in jsjs if condition andif else else if javascriptor in js if conditionand in if jsor in if javascriptelse if javascript is loopif else formatting oopif loopif en jsif statements in functions javascriptjs if statmentif statements javascriptjavascript no elsehow to write else if statementif and javascriptexample of if else statement in javascriptcan u have to if statements in jsif htmlif statements in the dom jshow does an else if statement workif 25 condition in jsjavascript if 2c then endjquery else ifif else js infoif en javascriptjavascript elsifjavascript if else alternativejavascript how to do if elseif statement in if statement jsif statement with else ifif else with for loop javascriptif clause jsif else in javascript to check conditionjavascript if 26 26js in in ifdifferent ways of writing if statement javascriptjavascript with if else 7b 7b 7d 7djavascript if statement with 26 26 and 7c 7cif loop javascript 5cif 3f jsif statement es6if or statement javascriptjavascript conditional statements and loopsjavascript statements ifhow to turn a else if into a function javascriptand condition jsjavascript use function in if statementjavascript if 2f else qiesif statement syntax htmlhow does else if work in javascriptjs if or statementif statement with in jsif 3a condition in javascripthow to use if in jshow to write if then statements in javascriptusing if statements in javascriptjavascript code if else statement examplejs if conditionjava script conditions statementsnodejs if statementif or in javascriptjs if and if elsecall function in if else jsjjs if else ifor in javascript if statementif if else using 3fhow to write if condition in javascriptelse if if statementsstart javascript function with if elsejs if if 3f 3a jsjs if with 3fjavascript if else syntaxhow do i create an if else statement in javascriptcan i use this in if statement javascriptjavascript if loop syntaxusing else ifelse in jsif loop in jsjs or if statementif or in jshow to write if else in javascriptelse idif else if javascriptif else statement in htmlelseif htmlif then in javascriptfor each and if else javascriptxx 22html 22 if statementhowe to write a functions with if statement jsworking with if else and function in jsor if javascriptjs syntax if 3fexample for if else in javascriptnew if statement javascript 3fif else condition in javascriptjs if elseunless statement javascriptjavascript if statement with and oorif else in for loop javascriptdetailed article about javascript else if statementelse statement node js 3d 3d 3dhow to do else if in javascriptif js 25if statement in javascript htmljs condition andnew if jsif condition in javascript with and operatorjavascript if input equal y or yif elseif else in javascriptjavascript if statement programif condition or condition jsjavascript if and ifjavascript if and statementjs function with if elseif elif else in javascriptconditional javascript that take the first false as positivejavascript if else statement multiple conditionsif and javascript examplejavascript if elifcall function if else javascriptif in htmlif 22in 22 jsif condition for or 7c 7c in javascriptjavascript or inside if statementif statement using and javascriptthen condition in javascriptif statement in javascriptif else statement htmlif loop javascriptif else statement in a function javascriptjavascript or in ifif statement with a 26 26 and 7c 7c jshtml if elsejs and conditionif statment in jsjavascript and ifjs text conditionalhtml javascript if elseif else css w3schoolsif else if condition js 26 26for and if in javascriptif else on javascriptnodejs if statementsjavascript if functionif 7b 7d jscondition in htmlif in jshow to do an if statement with 26 26 javascripthow to write modulation condition in javascriptif jsif else condition in html code in javascriptif else example jsnodejs if elsehow do you write if statement in javascripthow to name if else function in javascriptif 21 javascriptand if javascriptwhat is if in javascriptjavascript 3a if 28 21 29javascript if 28 3f 29javascript example code if statementsjquery if statmentif else syntax jsif else statement exampleif else elseif jswhat is better that a if else in javascriptelseif else javascript else if syntaxjavascript else if statementjava script ifif and function javascriptjs elseifjs if 3f 3aw3schools com if else in jsall ways to use if jsif else javascript optionsjavascript if in statementjs el ifif else javascript syntaxjavscript if elsejavascript string in ifelse if java scripthow to write if statement in javascriptjs else if or elseifjavascript function if conditionmake function for check if else in javascripthow to use if statements in jsif statement using 3f 3a in javascriptjs if this andif 2felse or syntaxif else js return to if in else javascript and or ifjavascript if this or thatfunction with if statement javascriptjs elsewhen do i use if if in javascriptjs 3f 3f ifjavascript else statementnode if elif elseif and else in nodejshow do we write if statement in javascript 3fcan we use if else statments inside the function 3f jsshow model on if condition in javascriptif else with loop jsjavascript if 3fif else using functionsconditionals in javascriptjavascript id in if statementhow to include and in if statement javascrif else using 3f mark javscriptif statement with javascript domfunction in if statements javascriptif statement using function jsif loop in node jsif function else if functionelse if em javascriptif conditions javascripthow to do elif javascriptif then javascript 40if and 40endif 40elseif in htmljs if else syntaxjavascript if statement and operatorjavascript if else else if exercisesjavascript if 3f 3afor and if javascriptif statement in es6for each if statement javascripthow to define if elseif jselseif syntaxend if statment javascriptif else javascript expressionhtml else ifthen that with if else jselse in htmljs ese ifif statement example in jsif if else syntaxjavascript if else and else ifif jsnode ifif value javascriptif statement with function javascriptif condition jsjs function with if conditionelse if statement jsfunction if condition javascriptife javascriptjs elese ifjava script condition 23else ifif statement html javascriptelse if conditional javascriptnode js if else conditionif and in jshow to write if statement jsjavascript elseifhow do if else statements workif statemetn javascript meaningand js ifjs if else 21 3dif else if condition in jshow to write if else statement in function javascriptif statment with and js 22 3f 3f 22 javascript ifif else statement in jsjavascript different ways to write if statementsif statement javascripthow to write an if statement in javascript to check the given variable is the same string among otherselseif jselse in javascriptify more than 1 statment javascriptelif in javascriptjs function ifif else ladder javascriptconditional statements in jsdo if statements need an elsejavascript if else statement in htmlif statements in jselse if javascript exampleif else else if statementjavascript else if examplejavascript if statement or operatorjavascript operation if elseif in javascriptjavascript conditionalsjavscript and ifif condition in nodejsif and else statement javascriptjavascript if condition definitionelse if statement javascriptif else if statementif else statement return javascriptwhy do we use if else statement in javascripthow to write an if statement in an if statement javascriptjavascipt if this or thiswhat is if else statement in javascriptexplain if else statement with example in javascriptif statement javascript 22 7b 22w3schools javascript if elseif statement in node jsand in js if conditionconitions in jsif and or javascriptnode js else ifjquery ifor inside if javascriptor in if else javascriptif else condition in jsjavascript else if loopjs elsefiand if in for loop javascriptif statemenrt js and condition in javascriptuse if condition in javascriptifthen jsif 2c else if 2c else javascriptif statements javasctripyif statement begins with javascripthow to make code with 3e 3d if elseif nodejselse if statementif else in javascriptif and statement jsifc javascriptjavascript if stateentjs if loopcondition javascript ifif condition in node jsnode js if condition orhow to know when to use an if statement in javascripthow to negate an if statement in javascriptif statement javascript examplejava script if statementsif else in javascript tipshow to apply if elsehow to use conditional inside of a function javascriptelse javascriptjavascript if loopfor if statementjavascript or ifif else loop jsjavascript if thisand condition in jshow to do an if statement in jsif else statement syntaxif function javascripthow to make if statemont in javascriptwhy else or else if javascriptif else w3 javascriptjavascript if else exampleif 26 javascriptjs if 3dor in if in javascriptfunction if jsjavascript if then elseif else and else if in node jsif else blockif else statementsnodejs or else ifusing a if method in jshow to make if statements in javascriptif statement operators javascriptif en javscripthow to do or 2fand in js if statementelse jsif else statement jsif 28 21 21 29 jselse for in jsif statement with 26 26 javascriptfunction in jquery if elseelsif javascriptor in if function jsif methode jsif inside or jsjs if condition in htmlif condition in javascript htmlnodejs if 3f then 3a elsew3schools if statment javascript if else statement 22html 22 exampleif else in es6 htmljs function if elsejavascript how to do or statementhow to write a if statement in javascript 3f 3a javascript if if 28and 29 javascriptif statemnt javascriptjs if statementfunction if javascriptif statement js 3a 3fif condition show plain html jshow to use conditional in function javascriptwriting if statements in javascriptif equal javascriptjavascript how to ifjavascript ifhow to write an if statement in javascriptsyntax if javascriptif statement nodejsif else if else javascriptif syntaxjavascript if then statementif then jqueryjavascript if else demoif else if statement javascripthtml if statementjavascript if 3f 3atesting if else statementsif else statemnt javascriptjs if andifelif jsif conditions jsjs if else with inif then else statement syntaxcontition statements javascriptiff 28condition 29if or statement jsif else if js in forjs if 3fjavascript if statmentjavascript if statemneusing or in if js 3f if statement javascriptelse if syntax in javascriptelse if javascriptif statement with 26 26 and 7c 7c jsand condition in if statementif else in js codew3schools js ifjavascript can you do a if statement in 3dif and function in jquerythe syntax write if statement js in a functionjs if using 3f 3aif else elseif else in jshtml if then elsejavascripts if statementjavascript ifthenif else if condition simple in javascript if statement in a function in jsjavascript if statement 3f 60if 3f 3a javascriptif then else else javascriptif and else in javascriptif statement in javasciptjs 3f 3a ifjavascript if statement 3ffor else javascirpjavascript if operatorsif or javascriptjava script if elseelse if jsusing and in js ifjs short if elsewhat is else if statementhow to write if statment in jsif statemtnt javascriptelse in node jsjs and in ifjavascript if and else statementsfor loop with if else if condition javascriptif then statements javascriptif and else if statement nodejsor in if condition javascriptnode else ifhow to put if else condition in if elsejavascript what are conmditionsjava script for if conditionelse and else if statementsif eles javascripthow many else if can you have javascriptjavascript if 2c 2cjs how to do an iff statemntif else if condition javascriptif and in javascriptif else functions javascript es6javascript string if statementdifferent way of syntax if else javascriptsif 28func 28 29 29 javascriptif else syntax in javascript 3f js iffor else statement in javascriptif else if in jsjsavascript if statementif 3d 3d ja 2b ja javascriptif else nodehow to explain if then elsenode js if statementif does not statment jsjavascript if else if w3if clause javascript or 7c 7cjs elifnodejs if else 3fjavascript elseif condition and in javascriptjavascript condition ifjs find if elsejavascript if with html elementif java scriptjs if if 2felse statemtnsjavascript how to do else ifjs function if statementjavascript if orjavascript and conditionif else condition in for loop javascriptone time use if jsjavascript fnction ifjs if and logicelse statement javascriptif 28 29 javascripthow to write if condition in jsif else function javascriptif statements with web jsif statement javascript and or how to do if statements in jsjs if 3fthe new if statement in javascripthow to use if and else in javascripthow to use if statements in javascriptw2schools if statements javascriptw3schools js if else 26 26 7c 7cjavascript close if blockwhat is the 3f 3a if statement in jshow do i use if else and return in javascript 3fjavascript if statementshow do else if work in jsif then else loops javascriptuse javascript if statement with 26 26javascript if or andif statement in a function javascriptcondition with javascript if else or and javascriptcreate function that includes if statement in java scriptand condition javascriptjavascript if statmentsif 3f 2f jsnode js if conditionif condition 3f 3a jsif else in a loop jsjs if with andif else loopfor loop and if else if condition javascripthow many else statements can be added in javascriptif 26 if jsif with or condition jsjavascript if statemetnsjs if statement varif stamenet javascriptjavascript and condition in if statementif and or i javascripthow to loop a if else statement in javascript if statement for javascriptjavascript if else es6else if syntax jsjs if inand or condition in javascriptjavascript if 3f 3a 24if htmlelse if else jselseif in javascriptif statement in javascript with orhow to use or in js ifif statement example jsif lese javascriptjavscript if 1 3d 1for else jsbasic if else statements javascriptand statement javascriptjava script if statement exampleand if jsif 28 3a 3f jsif statement javascript 7b 3f 3a 7dif else and function javascriptelse if javascript synstaxif else syntaxjavascript if and orif else node es6if else js 3f 3ajava script if orif statement in function javascriptif statements js andif and or condition in javascriptif else in javascript functionif elif else jsfunctions and if statements javascriptjs efficienly write if in ifif 28and 29 js js if or andjs if elsjavascript else ifif else new syntaxjavascript and condition in ifhow to use if method in javascriptvariable if else jselseif in jssyntax of if else statement in jsjavascript if else or operatorelse if statementsjavascript if inhow to create if else statement in javascripthow to use if in javascriptjavascript if conditionjavascript if else elsifhow to enter if condition at last time in javascriptif and if else in javascriptwrite if in else if javascriptjavascript es6 if elseif javascript andconditional statement in javascriptjs if variableconditional statement in function javascriptjs function elsesyntax of if else statement in javascriptand condition in javascriptput or in if javascriptconditional statement javascriptcondition 3f javascriptjs if syntaxjs else ifif statement 21 javascritif statement htmlhow to use in condition in a javascript if statement 3fconditions javascriptjs es6 if elseif if else jssjavascript if statemnetjavascript if else if function in jsjavascript if 21 21how to use else in javascripthow to write and in if statements in jsif else example 3f if javascriptif or 3f 3a javascriptor and if jsfor loop if else javascriptelse if in js 7c 7c in if condition javascripthow to use if else statement in javascriptshorter ways to write if else statement in javascriptif statement java scriptfunction if statement javascript 7b 3f 3a 7d if else javascriptif and jsjs if statement with 3fuse for and if jsjs ifelseif condition in css w3schoolshow to use the if in jsdoes if statements need elsejavascript if else ifif else statment node jsjava script what are conditional statementsand javascript ifif and then statement javascriptif method jsjavascript 22 23if 22and in if condition javascriptjavscript ifif statement in js functionjs if 3ajavascript 3f 3f ifif else statement in a server javascriptjavascript if else statementsyntax for if this equals this or that in javascriptjavascript if statemrnthow to check and or condition in javascriptw3schools com if else 28 3f 3a 29 javascript ifif else for loop jsif and else statementshow to write simple if statement jselse if syntax javascriptwhen to use else if in javascriptget from if to else jsif or javascriptelseif javascriptif 28 21 21 29 javascript if else if in javscriptif or function javascriptelseif loop js 3f if else syntaxjavascript if and thenhow to write if statements in javascriptif then if javascriptfor else javascriptif clause javascriptif elif javascripthow to if else jsif else statement function inside else statement javascript node js condition ifif else if condition jsif else statment javascirpt example application of if an else if in javascriptif syntax javascripthow to do an if in jsif if else jsif elseif jsif e2 80 a6else e2 80 a6 javascriptif statment in javascriptif that and that javascriptjavascript elifif else if in javascriptjs if 28 2c 29and in javascript if statementusing if statement in jsif with and in javascriptcondition if in js and in if loop javascriptsyntax for if else statementelseif java scriptfunctions with if javascriptcan you have an if statement in an if statement in jshow to write basic if statement jsif else syntax javascripthow to do equals in if else statements in javascriptjs 3f ifjs other way of writing if elsemjml else ifusing if statement in javascriptjavascript if else with 3fjavascript if statement syntaxw3schools php if elsejavascript if statement using 3felse is javascriptif and or statement javascriptwrite if statements with functions javascriptif javascript syntaxmultiple conditions if else statement javascriptcan you put anything on a if statement javascripthow to do if else statemtn in htmlelif javascriptjs if statmentshow to put a function in an if statement javascriptif in statment jsin javascript what is elseif elif else javascriptjavascript if or statementor operator javascript if statement 3f 3a javascript if statmente 24 7bif 7d javascriptways to write if statement jshow to write if condition in javascript functionjs if statement andif statment htmlif condition under else in jselse statement javascriptif elseif else jsif this and this javascriptif js syntaxelse if else statements jsif else and else if in javascriptif statement javascript 3d 3d 3djavascript if statement nodejs elseifjs if statementywhat does the mean 25 in if else statementfunction with if statement jshow to use else if in javascriptif 28 5b 5d 29 javascriptwrite if statement in javascriptjs if or conditionif 28 29 do javascriptjavascript if statement no elseif or and javascriptif javascript 3fif logic and method javasriptif condition with string in javascriptjs 3f 3a ifjavscript if statement 3dhow to write if statements in if statementsjs if thenwrite a function for if statement javascriptjs else ifif else es6 jshow to write an if statement javascriptif statement javasciptwhat is mean by conditional check on 22 22 in javascripthow to use conditional statements in htmlcanjs if elsehow to use strings in if statements javascriptif statements on jsjavascript syntax for if statementif condition in jqueryjavascript if or conditionjavascript shor for if elseif statement syntax javascriptif js w3schoolshow to give if else in html domand condition in if in javascriptcan we write condition in else statement jshtml if loopif else jqueryjavascript if condition with or operatorfor else in javascriptjavascript 23if syntax of if else statementif then statements htmlwhen to use conditional statement in javascriptjs if and elseelse if functionjavascript if statement to change stylejavascript if condition and operatormultiple else if javascriptif with 3f and 3a jsif 28 or 29 javascriptif 28 21 29 jsif statment javascriptif condition in jsjavascript 2b if statementusing elseifif 28 29 in javascriptif statements jsjavascript if clause with oror in if statement jshow to make if statements in jsjs using or and and in an ifor in a javascript ifjs if else in methodelse if object in jqueryif else blocks jshow to add elase condition in for loop in javascriptif else javascript examplefor loop if else in jsif else functionif loop nodejsdo if statements need an else bin jsif else jsif js 3fjs or in ifjavascript if 21 3cif condition for or and and in javascriptis else conditionn jsif in java scriptjavascript if condition 21 21if with jshow to use a logic in to parameters are same in alert y other wise else n jqif statement show to use if else in javascript using 3f 3aif loop jsjs if eleif loop syntax in javascriptadd if else condition in javascript and print answer in htmlhow to write an if statement in javascript 3fhtml if then else end ifelse if node jsexplain if else statement with examplejs if elsehtml ifhow to use and in if condition in javascriptelse if on the javascriptthe if function javascriptthe syntax write if statement jsjavascript if statement with 3fhow to display html table if condition greater then 0 in javascriptif statement or javascriptif elif in javascriptjavascript if condition in htmlconditional javasjavascript 3f if statementcan i write if elseif if in javascriptmultiple else if in javascriptif statement javascript syntaxjavascript conditional statementif else if statementjquery if and elsehow to add if in htmlif statement in jsif else codeceptjstypes of if else in javascriptif clause in jqueryfor in loop and if statement javascriptif in script in htmlif statement conditions javascripthow to do an if statement in java scriptif condition in javascripta function in an if else statmentjavascript if condition or 28condition or condition 29if different condition for string java scriptand statement in javascriptnode js elseif 3f javascriptelse if javascriptext js if elseif statement in a function in javascriptelse if in javascriptnode js if elsehow to do if statements in javascript and htmldefine if statements javascriptjavascript if stament dous 3d 3d to thenjvascript or in an if functionhow to write if condition in flowchartjavascript 3f 3a ifif 28 21 21 29 javascriptjavscript if 3d 3d orcondition in javascript if 3f 3a javsacript if elsejavascript if statement with orhow to use if condition in javascriptconditional html javascriptif javascript and conditionjs 3f 3f if elejavascript if else inside htmlcan there be an if statement in a function javascriptshortewr way to write if else statements in javascriptjs if 28 21 29es6 if else jsjs 3f if syntaxelse if jqueryjavascript if else elsielse functionif and else js 3e or 3d javascript if statementif else javascript examplesif ststements jsjava script if statementjavascript program on if elseif else statemtn structure in javascriptjavascript ifif in in javascriptcool javascript things with if else statementsjavascript what can you do with ifif statement in array javascriptconditional statement in java scripthow to use if statement in javascriptjavascript if clauseif else inside html javascripthow to make an or clause in an if statement in jsjavascript if else condition examplejavascript if ele if elsejavascript if 2felse statementhow to use and conditional in javascriptjs new if statementif javascriptif statements javascirpthow to create an loop with if else in javascriptif 25 conditions in jsjavascript if statement andhow to use 3f 28if else 29 javascripthow many else if statements can you have in javascriptnode js elsifif else em jsjs else loopjavascript or condition ifif and or in javascripthow to apply if else in htmlif else function in javascriptelse if javascript explainedif statement node jaif statement jvascriptif else in jsjs if else ifjavascript can you do an if statement in a functionhow many ways we can use if condition in javascriptjavascript 3f ifjavascript if 28 29 26 in if statement javascriptif statements with multiple conditions in function js nested iif else condition in jquerystyle javascript if elsejquery if elsejavascript if 28 29 3d 3e what does 3f mean in js if elseelse if in a for loop javascript javascriptelse examplehow to if condition in javascriptif 28 29 javascriptwriting if statement with 3f jselse if then javascriptif statementstry else in jsif else loopsif 3d in jsif 28 21value 29 in jselse if in java scriptif else statement for javascriptjavascript condition andif 22and 22 expression in jsif else operator in jsjs if 28a 29if 3d 3d in javascriptif then statetment jsjs writing if statements with 3f 3f 3f if else syntax jsif with or jsif syntax in javascriptif else loop in javascript tipshow to write a if else statement in javascript 22javascript if 22or and and in if statement jsjavascritp if text 3d 3djava script if 3fand in if javascriptuse if function javascript nodejsif javascript exampleif 3f 3a javascriptjavascript check if elseelse vs else if javascriptif ne java scriptif statement codenested if syntax in node jsfunction if elseif statements in javascriptelseif statement javascript 22 22 if jsor if in jsjavascript 3a ifor clause in javasciptif condition node jsif else if jqueryjs for elselaravel 2fuihow ot use else if in java scryptcan you use if in javascripthow to make an if statement in javascriptif else statement in javascripthow to add html into a js if statementif else statement javascripthow to write a else if statement in javascriptif else example in javascriptjava script else iffor and if in jsjavascript if 7c 7cjavascript how to do if else