#help in understanding how to code certains things

52 messages · Page 1 of 1 (latest)

sleek valve
#

what have you tried so far?

bitter scaffold
#

somewhat rude to just copy-paste your (homework-)exercise here and not even bothering to write one single word from yourself, then to expect us to just give you the solution? Just ask chatGPT and you get the result, but obviously you don't learn a single thing by doing that...

humble summit
humble summit
sleek valve
#

I am currently failing the class

One preliminary question in that case: is this your only CS related course in your curriculum?

humble summit
sleek valve
#

Okay. Asking because I have seen first-handedly students winging CS courses only to fail a few semesters later, because they were missing the basics, which then amounted to a huge waste of their time as they had to drop out at that point.

This server is indeed meant for help. But to help with specific questions and to overcome obstacles. By just dropping your exercise here verbatim you make it look like you want strangers to do your work for you. Which is seen regularly here and not well received.

Start of with what code you have, what you tried, how you approached the problem, and from there on people will usually be able to guide you towards a solution.

humble summit
#

OK yeah I get that but like I have 0 clue on what I'm doing and I need help that's why I'm asking I thought if I post it people can guide me

#

I have gotten 0 help from anyone and I get called rude for posting about getting help that's not even half my homework I have a whole list of shit

sleek valve
#

if you are at the very beginning of your coding journey, I'd recommend checking #faq where you can find several resources that guide you through JS principles. If you get stuck or have specific questions, then you are of course welcome to ask back.

humble summit
#

-.-

#

I have code can u help me

sleek valve
#

I believe so

humble summit
#

Are u actually gonna help?

#

Or just tell me off

sleek valve
#

depends mainly on you

humble summit
#

Uh huh

#

const tiger = (function() {
const weight = 90; // kg
const covering = "Fur";
const length = 3.3; // meters
const diet = ["Deer", "Wild pigs", "Buffalo"];
const predators = ["Humans", "Crocodiles"];
const habitat = "Tropical and subtropical forests";
const isEndangered = true;
const source = "https://en.wikipedia.org/wiki/Tiger";

return {
weight,
covering,
length,
diet,
predators,
habitat,
isEndangered,
source,
};
})();

// Displaying tiger information on a web page using HTML and JavaScript
document.getElementById("weight").innerHTML = tiger.weight + " kg";
document.getElementById("covering").innerHTML = tiger.covering;
document.getElementById("length").innerHTML = tiger.length + " meters";
document.getElementById("diet").innerHTML = tiger.diet.join(", ");
document.getElementById("predators").innerHTML = tiger.predators.join(", ");
document.getElementById("habitat").innerHTML = tiger.habitat;
document.getElementById("isEndangered").innerHTML = tiger.isEndangered;
document.getElementById("source").href = tiger.source;

sleek valve
#

Please add proper formatting and syntax highlighting to your code. Check #faq on how to do that. It really helps to read and understand your code and increases the chances of someone jumping in to help.

humble summit
#

<script src="tiger.js"></script>
</head>
<body>
<h1>Tiger Information</h1>
<ul>
<li>Weight: <span id="weight"></span></li>
<li>Covering: <span id="covering"></span></li>
<li>Length: <span id="length"></span></li>
<li>Diet: <span id="diet"></span></li>
<li>Predators: <span id="predators"></span></li>
<li>Habitat: <span id="habitat"></span></li>
<li>Is endangered: <span id="isEndangered"></span></li>
<li>Source: <a id="source" href=""></a></li>
</ul>
</body>
</html>

shut ember
#

I can see why you're failing...

#
  • you're asking people to spend their free time helping you at no cost. be respectful of other people's time. actually ask a question and show the effort you've already put in, instead of just dumping your homework question here and saying "help". you failing your class means nothing to us. we... don't... care... if you want help, treat people like you appreciate their time, not like you are owed their time. also, to make it easier for folks to help, format your question in an easy-to-read-and-follow manner. this includes syntax highlighting, which is incredibly simple to do.

  • you were pointed to #faq multiple times. this not only teaches you how to share code on Discord (see above) but also has a curated list of resources to help you learn JS. schools are terrible at teaching JS. as is evident from your sample code, you are being taught outdated methods and should take some time to review proper sources (if you actually care about learning the language).

  • https://phoenix35.js.org/good-practices.html#correct-use-of-js-in-the-browser

bitter scaffold
humble summit
#

I posted it so poeple will respond than I tell them what I have and haven't done

bitter scaffold
# humble summit I posted it so poeple will respond than I tell them what I have and haven't done

Post in advance what you already have, so people know if and how they can help you.
Again, as @shut ember said, we are here to help you LEARN TO CODE IN JS, which is sometimes something different than SOLVING YOUR SCHOOL HOMEWORK/EXERCISE. If you have a terrible school/teacher, you suffer like 90% of studens who need to learn web-tech. You are not the exception, you are within the majority. What sets students apart is if they are willing to learn JS at home in their free time despite what's going on and needed at school.
The confusion might also come from you thinking that learning JS by a regular school is like any other school subject. It straight isn't. If you want to learn JS and wqeb-tech, you must additionaly learn outside of the school. And we have really excellent ressources for that in our curated #faq . We can't help you more, you need to sit down, get some tea and start reading through the basics.

shut ember
#

my problem is all of it
this indicates you didn't bother reading any of the course material. go do some work.

humble summit
sleek valve
#

Okay, but we're not here to lament your curriculum, but to answer your JS-related questions. As Agoknee has mentioned, we're not offering a paid service, so we're a lot more inclined to help if you can state your business in a way that doesn't require us to fight our way through your text/ try to oracle what the problem is.

The code above looks mostly good at core. (Again: add syntax highlighting. I will default to not reading walls of code if it is not formatted correctly, because it's pain to do.)

What seems to be the issue with the code you posted?

shut ember
#

then start reading the resources in #faq

humble summit
#

But the faq isn't what I need for this project

shut ember
#

it is... but, the issue with your code is solved by following the advice at the link I pasted above.

humble summit
shut ember
#

loop array? there are zero loops in your code

humble summit
#

I posted above what I need did I do any of them in the code?

shut ember
#

as Len said, your code mostly works. you're just missing something I've now pointed out twice.

#

hint: the HTML elements don't exist when your code runs

humble summit
#

Huh

bitter scaffold
humble summit
#

OK that's why I'm asking for help from poeple who know what they are doing I searched html and Java help servers and thos popped up

shut ember
#

java is not javascript

#

you also seem to be missing the point we're all trying to make

humble summit
#

That I'm not allowed to ask for help

#

?

shut ember
#

and that'd be a confirmation... no, the point is how you ask for help...

humble summit
#

I've sent code that's what was asked I asked how would I put the other elements and was just told to go to faq

shut ember
#

is that really the only advice you've been given?

humble summit
#

Yes

shut ember
#

okay.

humble summit
#

And some other stuff but mostly no help

#

I'm asking the poeple in the server not go here do this I sent code that I don't understand and was just told ok cool u don't go to faq like bruh