Jump to content

Javascript help

Peeeeeeeeeeynk

Hi I'm practicing javascript at the moment,I'm doing these problems where I found on the internet where you have to code a program that does the follwoing.

 

I managed to get  the first one by using an if else but when I tried the if else again on the other numbers it did not work.

 

Any help?

I'm really new to javascript.

 

Determine whether the following expressions are true or false:
1. !true || !false
2. (true && !false) && (false || !true)
3. (4 > 5) || true
4. ("this" != "that") && ("zebra" > "aardvark")
5. ((4 >= 6) || ("grass" != "green")) && !(((12 * 2) == 144) &&
true)
Link to comment
Share on other sites

Link to post
Share on other sites

notification

 

Determine whether the following expressions are true or false:

1. !true || !false

true

2. (true && !false) && (false || !true)

false

3. (4 > 5) || true

true

4. ("this" != "that") && ("zebra" > "aardvark")

true

5. ((4 >= 6) || ("grass" != "green")) && !(((12 * 2) == 144) && true)

true

Mini-Desktop: NCASE M1 Build Log
Mini-Server: M350 Build Log

Link to comment
Share on other sites

Link to post
Share on other sites

Also, javascrpt if/else seems to work just fine for all of these problems as far as I tested

I am good at computer

Spoiler

Motherboard: Gigabyte G1 sniper 3 | CPU: Intel 3770k @5.1Ghz | RAM: 32Gb G.Skill Ripjaws X @1600Mhz | Graphics card: EVGA 980 Ti SC | HDD: Seagate barracuda 3298534883327.74B + Samsung OEM 5400rpm drive + Seatgate barracude 2TB | PSU: Cougar CMX 1200w | CPU cooler: Custom loop

Link to comment
Share on other sites

Link to post
Share on other sites

Also, javascrpt if/else seems to work just fine for all of these problems as far as I tested

sure. Those are all logical/boolean expressions that evaluate to an boolean value, which is needed in an if-then-else-statement

Mini-Desktop: NCASE M1 Build Log
Mini-Server: M350 Build Log

Link to comment
Share on other sites

Link to post
Share on other sites

sure. Those are all logical/boolean expressions that evaluate to an boolean value, which is needed in an if-then-else-statement

I know you can mentally solve them but the problem asked me to do a piece of code to prove if they are true or false 

.sorry should have mentioned that in the post xD 

Link to comment
Share on other sites

Link to post
Share on other sites

Also, javascrpt if/else seems to work just fine for all of these problems as far as I tested

I'm still new to javascript maybe my syntax sucks.

Link to comment
Share on other sites

Link to post
Share on other sites

I know you can mentally solve them but the problem asked me to do a piece of code to prove if they are true or false 

.sorry should have mentioned that in the post xD

var x = !true || !false;console.log(x)var y = ((4 >= 6) || ("grass" != "green")) && !(((12 * 2) == 144) && true);console.log(y)

Mini-Desktop: NCASE M1 Build Log
Mini-Server: M350 Build Log

Link to comment
Share on other sites

Link to post
Share on other sites

var x = !true || !false;console.log(x)var y = ((4 >= 6) || ("grass" != "green")) && !(((12 * 2) == 144) && true);console.log(y)

Thanks:D

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×