If anyone is proficient in Java, can I send you the challenge
description, and my code, via netmail, and have you give me tips on
what to fix? I'm getting something wrong I can't find on google.
If not, I'll keep plugging away at it.
If anyone is proficient in Java, can I send you the challenge description,
and my code, via netmail, and have you give me tips on what to fix? I'm getting something wrong I can't find on google. If not, I'll keep plugging away at it.
If anyone is proficient in Java, can I send you the challenge
description, and my code, via netmail, and have you give me tips on what to fix? I'm getting something wrong I can't find on google. If not,
I'll keep plugging away at it.
Re: Java Script killing me
By: The Godfather to All on Tue Jul 07 2020 23:12:20
If anyone is proficient in Java, can I send you the challenge
description,
Unsolicited nitpick and pro-tip:
Java and JavaScript are two different languages. Always remember
that 'java' is not a good shorthand for 'javascript' (but 'js' is
common and acceptable). This is important when communicating about
it and searching for answers.
Unsolicited nitpick and pro-tip:
Java and JavaScript are two different languages. Always remember that
This is ... fine, but brittle - which may not matter depending on the parameters of the assignment.
Hehe, I almost said something about that, I know Java, but am terrible
at JS, all that synchronous node js stuff does my head in.
I forgot synchronet uses JS - so more JavaScript wizards here than just
I like that you didn't even get the actual assignment and gave areasonable
answer. And probably an answer that's in line with what the teacher would expect rather than something a senior developer might come up with.
In retrospect I probably should have waited to see OP's code and just given some hints, since it's meant to be a learning exercise after all. Maybe we can go over the details if/when they reply.
---
Java and JavaScript are two different languages. Always remember that 'java' is not a good shorthand for 'javascript' (but 'js' is common and acceptable). This is important when communicating about it and searching for answers.
const obj = {
'Movie Name': 'Wyatt Earp',
Runtime: '191 minutes',
Genre: 'Western',
Characters: [
{ Name: 'Wyatt Earp',
Things: ['gun', 'revenge'],
},
{ Name: 'Doc Holiday',
Things: ['docks', 'holidays'],
},
],
};
undefined
The async stuff is a bit offputting at first, but it's not as bad as it seem Just requires a bit of a change in thinking. In recent years a lot of it has been abstracted away, such that one can write code that follows a more synchronous-looking pattern (see: async/await keywords in JS).
I think part of the problem is lost of teachers who explain async coding are VERY bad at it. I am including corporate trainers too. There is
people who will get students to write a game in C in no time who could
not teach you to do Hello World in node without messing your head up :-P
I liked the Movie name ... however, for some reason, they want itdifferent
as such ...
let movie {
title: 'Wyatt Earp',
This exercise is good practice, and I may attempt your other suggestion / challenge later after class as well.
const keys = Object.keys(movie);
keys.forEach(e => console.log(e, movie[e]));
Some formatting and handling different types of values is needed, but that's a start.
I like the short cutting; mine ended up stupid long but works. I haven't learned the keys function but am aware of it. I'll read up on it and forfun
give it a go this weekend and send it your way.
I realize the code is elementary; however I am only 12 days into the
class with no prior exposure. So I'll get there.
I can read peeps. echicken thanks for your input, it was my { [ syntax that had me off on the array within an array. The rest of the code was
Hope this helps what I was trying to explain; I was embarrassed to put what I wrote out there as I realize this is a first week type of
If you do write a function to print out the details, here's a hint:
const keys = Object.keys(movie);
keys.forEach(e => console.log(e, movie[e]));
It's okay.
You're going to write terrible code, make stupid mistakes, etc.. Because that's part of learning.
So nothing to be embarrassed about. We know you're a beginning coder, and it's okay to be a beginning coder.
That said, I'm still embarrassed at my own code. :)
--- Mystic BBS v1.12 A45 2020/02/18 (Linux/64)
* Origin: Storm BBS (21:2/108)
ofconst keys = Object.keys(movie);
keys.forEach(e => console.log(e, movie[e]));
So, the const keys line -- Object.keys() is a function to return an array
the keys (as strings) in an object. So, since the object passed to the
function is "movie", hopefully keys will contain (("Movie Name")("Runtime")("Genre")("Characters")...), with it being squarebrackets,
For the other line, the big picture is to loop over the keys and log the key, and then the content that's under the key.
But the reason why it'd be scary to beginners is because it's using a for/each loop, and an arrow function.
let movie = [
{
title: 'Wyatt Earp',
genre: 'Western',
runTime: 119,
characters: [ { char1: { name: 'Wyatt Earp',
age: 30,
items: [ { harm: 'Pistol', intent: 'Revenge' } ] } },
/* unclear why I need the "harm" in the arraya above 'items'. But it gotthe
prior "characters:" to console print 'Wyatt Earp'. however, for items, It outputs "un defined." I don't see why I would have to have char1 withinthe
bracket, seems repetitive and should be able to be pulled without it, witha
proper console.log ... But no go.
*/
console.log (
movie[0].characters[0].char1.name)
console.log (
movie[0].characters[0].items.harm)
I'm only 12 days into JS and I think they threw over a semester at us in that time. We have a API assignment I have to complete tonight, yet yesterday working with Arrays and Object assignments. They're so
I hope all is well! Seems like everyone must be back to work, or enjoying the outdoors (or for those in other regions of the world, napping in a warm corner of the home).
We've just gone back into lock down after having 100+ infection rates
for a number days to a week or so...Strangely enough I got to go and
play AV technician briefly at the "local" church.. they've been
streaming but getting choppy delivery.
Turns out they're trying to stream over wifi... thats shared around the building no less... chuckle...and shared in space with some mic's and all sorts.... its presently got a proof of concept wired link in place to
see how that goes. Its looking good though.
Where are you again? Why did they put you guys back under lock down?
to have not had that issue. Now wireless like your church? I can
totally relate. I need a better router then what MetroNet gives
us out here (Zyxel). The tech gave me an "upgraded" eero, but I
On 07-08-20 22:17, Spectre wrote to The Godfather <=-
We've just gone back into lock down after having 100+ infection rates
for a number days to a week or so...Strangely enough I got to go and
play AV technician briefly at the "local" church.. they've been
streaming but getting choppy delivery.
Turns out they're trying to stream over wifi... thats shared around the building no less... chuckle...and shared in space with some mic's and
all sorts.... its presently got a proof of concept wired link in place
to see how that goes. Its looking good though.
That'll do it. And yeah I use wired here for all the heavy lifting,
wifi is reserved for mobile devices. :)
On 07-12-20 00:21, Spectre wrote to Vk3jed <=-
That'll do it. And yeah I use wired here for all the heavy lifting,
wifi is reserved for mobile devices. :)
Nod, mines the same... the local N wifi doesn't like 2 x PS4's trying
to use it at the same time. Not that they're on their own. Wifi is
either mobile or convenience here... As yours wire is king...
Sysop: | sneaky |
---|---|
Location: | Ashburton,NZ |
Users: | 31 |
Nodes: | 8 (0 / 8) |
Uptime: | 56:49:10 |
Calls: | 2,097 |
Files: | 11,143 |
Messages: | 950,216 |