r/learnjavascript • u/[deleted] • May 21 '21
I am willing to help newbies learning JavaScript
Hello,
Apologies for the somewhat cheesy title, I am really not good at writing stuff, what I am good at is JavaScript/TypeScript.
I see new programmers going through Imposter Syndrome everyday and thought if I can make even 0.1% difference then it's worth it, So If any of the group members here need any JS help or guidance, Feel free to comment or personally DM me, and I will try my best to answer and help.
I am not selling anything, I do not own any course, any membership site etc.. just want to help group members. Not doing this for karma or upvotes either, feel free to downvote, upvote or whatever, just want to share the little knowledge I have with the willing.
About Me: I am self taught freelance web developer with experience in FullStack Javascript and typescript, has built many projects for international clients in my freelancing carrier.
My Tech Stack is MERN and SERN (S for SQL).
That's pretty much all, thank you for reading :)
EDIT: So majority of questions here in the comments and in my DMs were about one topic
What do i have do to be ready to build projects?
or
I keep watching videos and tuts but when i set to build a project, i feel lost, what should i do?
You get the idea,
so today i got a notification from youtube about a video on this same topic, and to be really really honest, it was THE most accurate video on this topic i have ever watched... the things he explain in the video, that is exactly what i did to be at this stage where i can literally build anything my clients demand from me.
https://www.youtube.com/watch?v=n7JhRDRK3Gg
Have fun.
17
u/CognitivePrimate May 21 '21
As someone struggling to learn JS, this is really awesome of you and something I hope to do in a few years when I feel confident enough. ā¤ļøā¤ļø
14
May 21 '21
Thank you and i know you would :) Feel free to post your code specific queries in the comments (recommended as everyone else will also benefit from the answers), or DM me personally if you don't want to post the question publicly.
12
u/ReuJesEst May 21 '21
where the hell do i start? there are so many resources I don't know what to do first/finish first/read first?? :(
39
May 21 '21
Hello, I know that feeling, I'll tell you what i did to break that ice. Just watch any JS Crash Course on Youtube (I recommend Colt Steele or Traversy).
Then watch DOM manipulation video on Youtube (again, Colt or Traversy recommended).
Then go ahead and implement a todo list web app in HTML, CSS and JavaScript. There should be just a div, an input and a button, user inputs some text in the html input element and clicks on submit button, and the text should go on in the div as an 'li' element.
I recommend you do this task and come back, tell us how you feel after acheiving this by yourself. If you get stuck, that's not a problem as well, I'll implement it for you and show you the code. But give this task your 100% first and be honest. Thanks
9
u/JeffreyGraessley_CwT May 21 '21
Thank you both! This is the question/answer I wanted most of all!
6
1
u/boof_gump May 22 '21
This is massive. Iāve been dabbling in js but didnāt know what direction to grow or how to implement it. Thank you so much for this answer.
1
1
u/Synchros139 May 22 '21
Thank you as well! I've been trying to figure out what exactly I should do. I have a few ideas but this is concise and clear. Have you thought of making a discord where you could post challenges/people could ask for help?
1
u/Acanthopterygii_Live May 22 '21
Thanks for the offer Js! I have a somewhat longshot question, I am building my own site( pretty newb) my handling of CSS and HTML is somewhat decent, at what point would you reccomend throwing in some basic JS? I look at snipplets of code and it doesnt seem to terrfying, could be wrong ofcourse. So do I keep hammering at HTML and CSS until I am 8/10 confidence level or?
1
0
9
u/Drextd May 22 '21
Hey mate, good to see other people like myself doing this kind of thing.
I'm an admin / mentor in a newly formed programming help discord.
Would be great to have more mentors around I'd you are keen to join.
Also anyone else that reads this post feel free join as well, it is welcome to anyone if any skill level
3
May 22 '21
Thanks mate :) I don't know if this subreddit allows discord or community links but I've joined anyways. Check DM
5
May 21 '21
Kind of related to JavaScript but could you explain to me how one would go about making a website with JavaScript as the frontend and python as the backend? I want to make a data chart on a site and itās a bit tricky
13
May 21 '21
Sure, for the frontend (SPA Single page applications = frontend that do not reload the page), you'd most probably use libraries/frameworks like React, Angular, Vue, Svelte etc, You can certainly built a SPA frontend without those frameworks but it's hella lot harder to do so on your own, so better use any of the above framework.
for the backend, you would create REST APIs on the python backend, so that you frontend can communite with your Backend. the data that is exchanged between frontend and backend is of type JSON (JavaScript object notation). don't worry just because it has JavaScript in name doesn't mean it can only be used in JavaScript, infact Python and mostly all other languages support JSON format.
Conclusion: you would create REST endpoints on your backend, and make your frontend to communicate with the backend through those APIs.
if you have any further questions, feel free to ask. Thanks
6
May 21 '21
This is very helpful and exactly what I need to look into and become more familiar with, thank you!
8
3
u/Noxyed2099 May 21 '21
Hey! In your opinion, how much pure javascript should i learn before i tackle something like react?
7
May 21 '21 edited May 22 '21
I'd say once you are really comfortable with ES6 syntax of JavaScript, spread operators, module system, Destructuring etc... then should you tackle something like React.
Edit: Meant Array and Object Destructuring and not Restructuring.
2
u/Budget_Instruction49 May 22 '21
destructuring ? or restructuring mate
2
May 22 '21
You're right, i meant object and array destructuring. sorry for the typo and thank you for letting me know :)
2
1
3
u/totaldue May 21 '21
Thank you so much! Are you able to help out with data structures and algorithms at all? I've found these tricky at times... I feel like sometimes I'm not smart enough for programming and it takes me a while to solve some coding challenges.
8
May 21 '21
Hello, The question that you might wanna ask yourself is that do you want to solve coding challenges, or solve real life challenges by building useful projects?
because byfar I've worked on like hundreds of big and small projects, and not once did i need to know fancy data structures and algorithms. Maybe i am not that good of a programmer, but I've heard experienced programmers tell the same tale.
Do not judge yourself by your ability of solving complex algorithms, build projects, gain experience, then if you feel like it go on and tackle algorithms.
P.S: I don't have anything against DSA, i just feel like new programmers shouldn't worry about DSA much, and rather focus on learning to make projects. If DSA is part of your college curriculum than that's fine, but other than that, try to build crud websites and other projects.
Thanks :)
3
u/totaldue May 22 '21
I really appreciate your detailed feedback. I feel like I'm actually alright when it comes to making little apps and what not (like a to do list or words games, basic sites, simple things of that nature).
But I always feel a bit inferior when I can't solve some of these coding challenges. I like to learn things deeply and I felt very inferior when I was struggling, so much so that I've taken a break, and lost some motivation.
I've been learning for about 6 months total now. Perhaps I should get into some React via the Odin project. I'm actually a graphic designer by trade and learn programming in my spare time. I'm also pushing 40 so a bit wary of ageism when / if I decide to apply for web dev roles. Although I feel like my design background will probably help as it ties in somewhat with the field.
I also realise that I'll probably need to start from the bottom as a junior and will likely have to take a bit of a pay cut. I've checked Seek (I'm located in Australia) and a lot of the entry level roles seem to require vast knowledge, so there's just so much to learn!
Thank you again for taking the time to reply : ) I might have some other questions if that's cool...
3
May 22 '21
Hello, I totally understand. trust me, as a full stack dev, learning how to make CRUD (create read update delete) apps with like JavaScript/nodejs + mongodb will help you more than DSA, but if you are eager on problem solving, a good site that i used myself was edabit, solved many coding challenges there in my college days. But I know change comes gradually, and requires hard work. but it's worth it in the end. Feel free to ask your questions, I'll try my best to answer as much as i can. :)
2
u/UnoStronzo May 22 '21
I have minimal experience with JS. Iāve been working on a web map with several layers of data in geoJSON format using the Leaflet JS library. Iāve successfully loaded all the geographic data, and Iām stuck at the last step: make a manual photo slideshow appear in a modal popup box after clicking a geographic feature. The event works and the popup content appearsājust no slideshow :( Any help will be appreciated!
1
May 22 '21
Hello, Can't say much right now, you'd have to share or show the code for us to see what's causing that...
1
u/spinelust May 22 '21
Have you tried setTimeout (everytime the pic appears, you put a timeout to use different source url for this element)?
2
u/ImdustriousAlpaca May 22 '21 edited May 22 '21
I'm definitely in need of help, I got pretty far a couple of years ago, life got in the way and I'm back on the wagon, started building some low level HTML CSS pages to get the feel of things again. I would like to jump into js after that, and move to react eventually. Obviously need to find a job as a dev of some sort after that. Any help would be appreciated.
3
May 22 '21
That's great, never too late to learn. :) Well all i can say to you right now is that continue learning JS via google/youtube and if you get stuck or need clarification on something, you are most welcome to ask here. Thanks!
1
1
u/Harry-1062 May 22 '21
Hi, I need help. I don't know anything about javascript. I came into a problem in which I have written some HTML code in an HTML file, Then I created a js file and write a function. I am calling that function in HTML code. Problem is i need to pass some string from HTML to js function and use as an property value in js. please help
1
May 22 '21
Well, if i understand correctly, you are using JS function in HTML on some kind of event like
onclick? then you might do this to pass the string as argumentonclick="someFunction(\''+string_argument+'\')"Since you are actually calling the function on onclick event and not refrencing it, you can pass the arguments directly in the parentheses of the function. Hope it helped :)1
u/Harry-1062 May 23 '21
thanks for the reply.
I have no issue in passing the value. I am facing problem how to use that value inside the js function as a value of property. eg.
function (a_var) {
--some code---
id : 'abckdefdf'
}
this 'abckdefdf' need to be dynamic. need to changed by a_var
1
u/Todd6114 May 23 '21
Could you not just do id = a_var or id: a_var
1
u/Harry-1062 May 24 '21
yes its worked. thx . i do not why it did not work previously .
1
u/Todd6114 May 24 '21
No problem! Iāve been there before⦠code doesnāt work. Cut it and re-paste my exact code and then it works!? Glad itās working for you
1
u/Joydom29 May 22 '21
This is so kind of you omg. Iāve been meaning to learn javascript since I think itāll be helpful to go with my graphics design knowledge. But atm it just feels very confusing. It feels a lot like learning a whole new language (and Iāve always been bad at learning languages haha). So I was just wondering where would be a good place to start?
1
May 22 '21
Hello, That's great and yeah lol, it's like learning a whole new language indeed.
Well, the best resources are
Mozilla MDN docs (which are great as a refrencing point but not as a starting point IMHO)
Then you have the legendary Youtube, which i myself learned from.
Then lastly, if you want a more premium experience of learning, you could go with JS course by Stephen Grider and Colt Steele on udemy.
The thing that made me write this post was not the lack of resources, but lack of a programming buddy that one can ask questions from, I'm trying to fill in that gap :)) So, if you have any questions or need any explanation on JS/TS/HTML/GIT/Docker/Linux etc, feel free to comment or DM, if i know the answer, I'll reply back.... if i don't know the answer than I'll research and reply back lol. Thank you.
1
u/Joydom29 May 22 '21
Gotcha thank you sm! Iāve been meaning to find the time, but itās nearing finals week so I havenāt been able to actually start learning. Iāll probably try it out once the semester ends (and my brain cells arenāt dying). Once I do start learning tho Iāll def take you up on the offer to message you!
My friends that do code say itās best to have a project to keep you motivated in learning but I find it so hard to think of one haha.
2
May 22 '21
My first fullstack project was a URL shortener app, i can tell you more about it if you want, but the gist is to build something. If you don't know the backend, you can start with a todo list app with localstoage support for data persistance, that would also be nice :) Thanks
1
u/bananajaviert May 22 '21
Hello, thank you for you and this post.
I have a question. When do i use asynchronous in fetch APIs. Do i always need to implement async when fetching data? Thank you, Iām still a newbie.
2
May 22 '21 edited May 22 '21
Hello, Yes, while using
Fetch APIyou either useAsync/Awaitor you chain it with.then() and .catch(). An example of that would beasync function returnDataFromUrl( url ) { const rawData = await fetch(url); const jsonData = await rawData.json(); return jsonData; }In the above code with create an
Async functionin which we use theawaitkeyword to wait for the data to come back from fetch, and then we wait for that data to be converted tojsonformat, and then we return it. If any further questions, feel free to ask. Thanks1
u/bananajaviert May 22 '21
Thank you for the clear explanation! I'm sorry to disturb you again but, I've encountered a problem. When I test my website on my localhost, it does not throw any error. However, after I deployed it to the web, some functionalities do not work, as well as my fetch API.
2
May 22 '21
Hello, It's no bother, happy to assist here. Can you post the code so that i can see what's going wrong there?
1
u/bananajaviert May 22 '21
Hello, I've posted the problem on this subreddit. I've explained the problem carefully.
This is the link to the post.
Thank you!
2
May 22 '21
Hello,
I saw the post, but still, you need to show me the actual javascript code because then would i be able to help you.
you can use codesandbox.io for this task. create an account there, then create a static sandbox there, and put your code there. then share the sandbox link with me here or in DM and then i will be able to tell you exactly whats the problem in your code.
Thanks
1
u/bananajaviert May 22 '21
Hi! I just edited the post. The code is now shown on the actual post. Sorry for the inconvenience hehe
1
May 22 '21 edited May 22 '21
The last console error showed in the post means that
fetchcannot find the filescripts/offer.json, 404 means not found.1
May 22 '21
[removed] ā view removed comment
2
May 22 '21
JS is an
Asynclanguage by design, sometimes we want to block thatAsyncnature of JS and make it Synchronous, and Yes you are right, that's whatasync awaitdoes, because if execution continues without us waiting for the data coming back from fetch, that would result in many errors.
1
u/amadeusjustinn May 22 '21
Um, I have a simple question: what is the difference between Typescript and Javascript?
4
May 22 '21
Hello, TS is a Superset to JavaScript.
It's like if superman had a son which has the all the powers of superman but also much more since he is born on earth, he has more strength than superman, more faster than superman etc but at the end of the day, he is still the son of superman...
In that analogy, TS is son of JS which has all the powers of JS and much more, but at the end of the day, whatever you write in TS gets compiled down (translated) to JS code by TS compiler.
TS offers static types to the language like String, Number, Boolean etc, so that we can catch type bugs during development instead of runtime. Other than that, we can create our own custom types in TS using interfaces and type keyword. One more added feature is that we can target older browsers as well because in TS we have the option to compile TS code to ES5 JS. and much much more..
Conclusion: The difference is that TS has more features than JS for developers and not the end users, for end users, TS code gets compiled down to JS code which we can run in browser or on Node Runtime.
Thanks!
1
u/diogenes_sadecv May 22 '21
I'm always making goofy projects just to entertain myself. If someone's into it, I would love for you to look at my repos and point me in a direction to go that has the best chance of employment or profit. I want to continue growing as a programmer but I feel like I'm pretty myopic about the wider programming world.
I guess I want something like a one-night-stand of mentorship =P
1
May 22 '21
Hello,
That last line of yours is hilarious. And sure, DM me your GitHub link and I'll surely look into your repos and provide suggestions.
Thanks!
1
1
May 22 '21
What do you use for displaying charts on the screen?
2
May 22 '21
Hello,
I use chartsjs, but D3 is also a really good option, might even be better than Chartsjs.
Thanks!
1
u/AtomicOrwell May 22 '21
maybe we can start open source projects that everyone can contribute to and learn on the way
1
1
u/Ok-Yesterday8492 May 22 '21
I would love to be helped. How do I get started on the journey of Javascript? I'd appreciate resources that can help me get on the journey.
2
May 22 '21
Hello, I started from Youtube, you can start by watching the code camp playlist on colt steele channel, he is a great instructor, one of the best. Traversy media is a also a really great programmer on YT. After watching and learning the concepts, it's better to go and build something. Then that knowledge will stick with you forever. Thank you.
1
u/Ok-Yesterday8492 May 23 '21
Perfect response. Iāll look up both of those on YouTube. I am really passionate, and hoping to report back here a couple of months hopefully having built something by then. Wish me luck!
1
u/ExOdiOn_9496 May 22 '21
Hello ive been looking to apply for a junior position. What would u say are some of the most important topics to pay attention to for the interview ? As in JS and React specific topics.
1
May 22 '21
In JS, most intermediate to big companies like to ask data structures and algorithms related questions, and for React, that should be hooks, lifecycle methods etc.
in small companies, they tend to ask questions specific to thier problem set and not generic data structures, because they need value from a progammer, they need someone who can help them build their product instead of a guy who has algorithms memorized but cannot help them build stuff.
thanks!
1
u/curious_human21 May 22 '21 edited May 22 '21
What are good websites to find work as freelancer? I did 2 projects on freelancer.com but as a free member, the site only lets you bid once in every 5days. I am ready to buy a premium membership but it won't let me buy any membership unless, I have a visa or MasterCard credit or debit card, which I don't. So, I am looking for any other sites where you can get started easily.
PS: I am not JavaScript developer but a python developer but I don't think it makes much difference in this context.
2
May 22 '21
Hello, Fiverr is a good option, it's my main work platform, so far so good it is. There's no any paid membership there which is a plus, and you can bid on projects but most of the time, client's directly contact you through your gig Thanks !
1
1
u/mrgelk May 22 '21
Wow! If the world had only a few more like you it would be a much better place. Thank you for this!
2
1
u/OnlyProductiveSubs May 22 '21
I'm about to start a new project in a few weeks, would you mind giving me any input or pointers that could be useful down the line?
The plan is to setup a website that'll allow people in my country (or any country, technically) to get an email or text if there's a new listing on either of the several housing websites here.
There's loads of desperate students every semester and it should be of use in that situation.
Something that'd be great would be MERN stack, have each new listing be listed on the users profile on my website, or alternative just send them the url / collection of urls.
Im thinking, if the website's dont have a specific api for checking new listings, it should be possible to simply have the website do rest-calls to a generated url with filters for pricing etc, then from the html sort out if there has been new posts, and if new grab the relevant html and save it. If the most recent rest call had an identical response or not basically.
For hosting I'm thinking digitalocean, install ubuntu, and then install nodejs and upload the website. I have a domain name already, intending to point that to new host. I've previously only used hosts that sort out the backend for you, so nodejs projects are a bit of an hassle.
Sorry for wall of text. But it seems feasible, right? Any input?
2
May 22 '21
Hello,
Well, there are two obvious ways to approach this problem.
As you said, if the site provides REST api for getting listings, that's perfect. we can simply ping the API every 1 or 2 mins to get the latest listings.
If there's no any kind of api to get the listings from, the task becomes somewhat cumbersome, because now we would have to do web scrapping (loading the html page and scrapping it for data) in order to get data from those listing sites.
As for the deployment, yeah it's a bit more work to deploy projects on a self managed server, you'd have to configure web server, dns, firewall and stuff on the server to get it running, then installing correct softwares like node, npm, mysql or MongoDB to make sure all the dependencies of your software are met on the server side.
Thanks :)
1
u/Budget_Instruction49 May 22 '21
in what order i dhould learn ?
-> react,featgersjs,sequelize,node
2
May 22 '21
Hello, For me it is Node -> Sequelize -> React -> Featherjs? Thanks !
1
u/Budget_Instruction49 May 23 '21
CODE - let date=moment.tz(date,'America/Los_Angeles').format('dddd,MMMM D,YYYY');
do you know how can i get my same date from database ?
when i sent mail , date is always a day behind from USA Date
1
u/otherreddituser2017 May 22 '21
Hey there, thanks for this post, it's super kind of you! I've just finished my first non-tutorial completely custom project. It's only a todo listo but I tried to add in advanced features and push myself to make it great.
I don't know if this is what you have in mind, but would you mind looking through the code and telling me how I could improve? I'm sure I've made a lot of basic mistakes or done things that are not considered standard, and I really want to improve.
It's got localStorage, gestures, touch screen detection with different interfaces for mouse and touch, installation as a PWA, animations (the first time I've ever used them).
If this is not what you had in mind then don't worry :)
jsvanillatodo.netlify.app
1
May 22 '21
Hello, That's a lot of features in a todo app, nice work man. Sure thing, I'll go through the code and provide feedback :)
And thank you for your kind words, appreciate it.
1
1
u/geekshivam May 22 '21
Can your share materials fo jsr interview questions or resources?
1
May 22 '21
Hello, on Udemy there are two very good courses on this topic, One is by stephen grider and the Second is by Colt Steele (Data Structures and Algorithms) Both are paid tho, usually around ~ 10 bucks, but are really good. I myself am subscribed to these courses, but i like Colt Steele's course more than Stephen's. Thanks :)
1
u/shiningmatcha May 22 '21
Hi, OP. Iām learning JS with experience in Python. I often find that itās not as convenient as in Python to write some simple functions like sorting and summing because JS doesnāt have these builtin functions.
But Iāve found people can do it in a very simple way - use libraries. Personally I tend to avoid third party libraries except those famous ones like numpy and pandas for Python and React and Vue for JS. What do you think?
1
May 22 '21
Hello,
JavaScript has built-in sorting function on Array prototype chain, which mutates the original array and sorts it [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort]
Third party libraries are fine to use as long as they in active development and community is good, one very famous utility library for JavaScript is Lodash which has a huge set of helper functions which can be used to achieve different tasks on Array and Objects.
Thanks!
1
u/ssjskipp May 22 '21
Have you checked out https://exercism.io/?
1
May 22 '21
Nope, but I'll look into it :)
1
u/ssjskipp May 22 '21
Yeah, when I was in a kick of itching to code but not wanting to engage in a huge project, I started mentoring JS/TS and Scala there. It was really fun and definitely nice to just help a lot of new programmers.
My thought was, "It would be awesome I can get them when they're starting with some best practices and quality code."
1
u/No-Criticism2437 May 22 '21
An off topic question but how complex would the JavaScript code base be ,when used to build say a saas app with like 700k users, and how long would it take a guy to make sense of it who has really good grip on js but has never worked professionally
1
May 22 '21
Hello,
I don't think i understand your question fully,
It's not possible for me to answer this question with certainty, since a todo list app with basic auth and user account system (technically a SaaS) is relatively simple to build and yet can be used by 700k users.
The complexity in above case doesn't come much from the code itself, but how you deploy it on the server, how you manage the database, how you handle database replication and failovers, how you load balance between different servers between different physical locations, almost none of the above mentioned things are related to code or Javascript itself, but rather the server infrastructure.
So the gist of this is that not every complexity can be measured by a simple ratio as in your OG question and not complexity is code related.
I hope my answer made sense, if you don't understand anything in my answer, feel free to comment.
Thank you!
1
u/No-Criticism2437 May 22 '21
That makes sense sever management and scaling is a huge thing in itself.
I meant how hard would it be for guy who has great command over JavaScript but hasn't worked professionally to make sense of the codebase of a startup he is about to join
1
May 22 '21
Well, I'd say that it'll be a time consuming thing so kinda hard yes, you will constantly try to make sense out of someone else's code, you will ask your colleagues for help in understanding it, you will google things (yes, even if you have in depth knowledge of JS), you might even break a few things in code which is also normal, that is why tests exist :)
1
May 22 '21
I am currently learning about the DOM. One thing that confuses me is that editing the DOM feels like just editing a Html or CSS file. My question is, why not just edit the html/css file instead of using the dom?
Sorry if this is a dumb question, still learning the basics dom
2
May 22 '21
Hello, It's not a dumb question at all, but a valid one. you see, when we edit html/css directly, almost all of it loads and shows up immediately as soon as the page loads. Now that might be the behaviour that we want in which case it's fine or even better approach to edit html css directly.
But when events are involved, when we want to show different things with respect to how user interacts with the site, that's when we use JavaScript, that's when DOM is useful for us. For example, we want to show a certain div when user clicks on a button, to add that kind of functionality we would use JS. Now why would we wanna add a div via JS when we can add it directly? well, again, for dynamism in the site, to load data dynamically and not statically (directly adding in html).
Hope it made sense, Thank you
1
1
May 23 '21
Iām learning js right now, I want to go after it to typescript, react and next or gatsby, after those, should I learn node js?
2
May 23 '21
Hello, If you wanna get into the backend development as well after you've done all that frontend stuff then yeah definitely Nodejs is amazing for that.
1
May 23 '21
Thanks for answering. Honestly my first objective was to make apps for iOS using react native but one thing lead to another one and here Iām learning web development š . I donāt like to much the idea of backend but I read that I need it to make user accounts and so, whatās your opinion?
1
u/Budget_Instruction49 May 23 '21
CODE - let date=moment.tz(date,'America/Los_Angeles').format('dddd,MMMM D,YYYY');
do you know how can i get my same date from database ?
when i sent mail , date is always a day behind from USA Date
i am from india. from local mail , its getting right date, but from usa server, date is one day behind
2
May 23 '21
I didn't quite understand your problem but maybe try this?
moment.utc(date).local().format("YYYY-MM-DD HH:mm:ss")1
u/Budget_Instruction49 May 23 '21
hey mate. thankyou. I will explain in more detail now.
i am in india. my project is being hosted on usa server.
when i send an email from my local environment. i will get correct date.
when i upload the project to usa server. i will get date in the mail , but if i mail 25th may , i will get 24th may 2021.
i am using this code date=moment.tz(date,'America/Los_Angeles').format('dddd,MMMM D,YYYY');
and sending this data to my mail. thankyou for replying. i will dm the codes if you need more.
1
u/Fabergio May 23 '21
Hello,
I have a problem with accessing some json data via a jquery-ajax request in JS. I keep hitting against a 'Cannot read property [...] of undefined' error. This is part of my education so I have to access the elevation data in this way. I'll attach my code, you'll need jquery-1.7.1.min.js and ol.js libraries downloaded in order to open it correctly. I'll be immensely grateful to whom will have a lead on what I'm doing wrong.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb"><head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><title>Trial</title>
<script type="text/javascript" src="libraries/jquery-1.7.1.min.js"></script><script type="text/javascript" src="libraries/ol.js"></script><script src = "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
</head>
<body><div class="pagewrapper"><div id="header"></div><div id="controls"><h1>Controls</h1><div ng-app = "myApp" ng-controller = "locationController">Enter SourceID (from 0001 to 0012): <input ng-model = "location.Source"><button class="btn btn-default" ng-click="location.getElevation()">Search</button> <p>Elevation: {{location.ele}}</p></div></div><script>var mainApp = angular.module("myApp", []);mainApp.controller('locationController', function($scope) {$scope.location = {Source: ('0001'),getElevation: function () {$.ajax({url: 'https://services.arcgis.com/Sf0q24s0oDKgX14j/arcgis/rest/services/gpsData/FeatureServer/0/query?where=Source='+$scope.location.Source+'&outFields=*&f=geojson',method: 'GET',
success: function(response) {$scope.location.ele = response.features[0].properties.ele;$scope.$apply();},
error: function() {}})}}})
</script></body></html>
1
May 23 '21
Hello, The error you mentioned means that in
response.features[0]. properties.ele, any one of the property is undefined, so can you show us the result ofconsole.log(response)?1
u/Fabergio May 23 '21
I'm sorry but I don't know how to do what you asked me, I was relying on the console from G. Chrome until now. There I currently get 'Cannot read property '0' of undefined' error. I tried to refer to other features by changing the 0 with other numbers, as well as deleting it, but it still remains undefined.
1
May 23 '21
Cannot read property '0' of undefinedmeansresponse objectorfeaturesinsideresponse objectis undefined, which means thatresponseis not coming back properly.1
u/Fabergio May 24 '21
Yeah exactly. However I'm out of ideas for how to correct this
1
May 24 '21
Can you give me the URL on which you send the
getrequest1
u/Fabergio May 24 '21
The URL depends on the Source input from the user (Sources going from 0001 to 0012). In the case of 0001 this is the URL:
1
u/Livid-Crazy-7743 May 25 '21
The response is not being parsed as JSON, it's just a string.
Two alternative and easy solutions:
You could use
$.getJSONwhich does the work for you:$.getJSON('https://services.arcgis.com/Sf0q24s0oDKgX14j/arcgis/rest/services/gpsData/FeatureServer/0/query?where=Source='+$scope.location.Source+'&outFields=*&f=geojson'). .done(function(response) { $scope.location.ele = response.features[0].properties.ele; $scope.$apply(); });Or you can parse the response yourself:
$.ajax({ url: 'https://services.arcgis.com/Sf0q24s0oDKgX14j/arcgis/rest/services/gpsData/FeatureServer/0/query?where=Source='+$scope.location.Source+'&outFields=*&f=geojson', method: 'GET', success: function(response) { response = JSON.parse(response); $scope.location.ele = response.features[0].properties.ele; $scope.$apply(); }, error: function() { } });
1
u/cloud_technodreamer May 24 '21 edited May 24 '21
”Hi guys!
Ā”I'm ready to learn! š§
I want to gain confidence, by start to write code by myself and understand the way of handling errors and the asynchrony of the language.
Isn't common to find this kind of initiative, or maybe I was not in the right place though. The only thing that I know is that I will follow this thread. Ā”Thank you! š
1
1
u/cyborg7ofNine May 25 '21
<p></p>
<script> document.getElementByTagName("p").innerHTML = "Hello Dolly."; </script>
Could you tell me why this is not working? I don't want to target and id.
1
May 25 '21
Hello, It's not working because once you target by tagname or class, it's possibly gonna grab more than one value, so try the below code
document.getElementByTagName("p").forEach((e)=>{ e.innerHTML = "Hello Dolly"; })1
May 25 '21
The method is called document.getElementsByTagName, with an s because it doesn't return one but all matched elements that it finds.
I would suggest using
document.querySelectorordocument.querySelectorAllinstead. "All" makes it easier to remember that it returns a collection of elements not just one, and harder to omit it by mistake as you did with thes.Other than that, when these methods return more than one, you'll need to iterate through the results.
1
u/Excellent-Entrance42 May 25 '21
Should we know full javascript/typescript for Frontend ?
1
May 25 '21
Not necessarily, if you are just starting out then basic fundamentals are fine to have, although something like React, Vue or Svelte would require some intermediate to advance knowledge of JavaScript.
1
u/vicded May 26 '21
Hi! I have a doubt regarding functions, in which cases is better to work with a function like function sum(){... } against const sum = function () {} sorry for the formatting but Iām in mobile lol
2
May 26 '21
I have almost never used the later function definition method, but if these are the only two options for you, then the first definition method should be the way to go.
My suggestion however is to skip the above two and use the ES6 arrow syntax if possible, looks like this
const someFunc = (optionalParams) => {...}1
u/vicded May 26 '21
Thank you so much for your answer. I have one more question regarding functions, In some cases Iāve seen functions declared inside methods such as in Object.forEach( function() {console.log(āOne for eachā)}; why is a function needed or when should I use a function as a parameter
1
May 26 '21
That is what we call a
callback function, there is no way for us to tell in whichfuntionormethodto use thecallback functionin unless we check the documentation for that function
1
May 22 '21
This is a really nice thing. And I wouldn't ever think about saying otherwise.
But do you mind if I ask you a question? Why not just start answering the questions and problems people already submit to this subreddit -and others-? I mean, this is exactly what the subreddit is for. People submit their questions and their problems and you could just help them like others do.
There's also a benefit in doing it in the open and not through DMs: all can help and all can be helped. Someone may not be the person who submitted the question but still read it and learn. Someone may already have answered but some else may offer additional details or a different perspective.
1
u/kayshim May 22 '21
Hi there i will be happy to any help from you regarding JavaScript, typescript as i am new to full stack development. Waiting for your DM.
1
u/gcMonkey May 22 '21
Would you be willing to share your experience on how you got started with freelancing and getting first clients?
1
u/pearomaniac May 22 '21
So i started learning some of the stuff on udemy and its a course for a complete beginer, i understand how most stuff works and what is what, what is bugging me is having troubles remembering stuff that i have already went through. Do you have any sugestions how to memorize stuff or some basic practices i could do?
1
u/TheMadHatter2048 May 22 '21
Im going for fullstack !!! I know bits and pieces of things Html Css Js Php
2
u/bulloh4 May 26 '21
All the way from the jungles of Africa, thank you for this. I know a little python but I hadn't coded for a while. I want to learn JS as a way to 1) give me a different way of thinking of things and 2) get a job as a developer.
I am typing this while seated in a tree BTW.
1
May 27 '21
Hi there i am taking a bootcamp course at general assembly so i am new to everything using programing nice to meet you. My fist question i am attending general Assembly I am wondering when i graduate where do i start when it comes to getting a job .
0
May 22 '21
[deleted]
1
May 22 '21
Fortran :) JK lol, I use React so i am a bit biased, but vue is also an equally viable option. but for me, React it is. Thanks!
0
May 22 '21
[deleted]
1
May 22 '21
Hello, Picking up MERN would def up your chances of finding a high paying job. But even without backend, you should be able to land a junior dev position with the above skillset, Sanity is a really great headless CMS. But again, Learning MERN is def worth it.
Thank you!
3
1
May 22 '21 edited May 22 '21
[removed] ā view removed comment
2
May 22 '21
Hello,
Look, do not overwhelm yourself by taking every tech and tool into consideration..
start small, when i started freelancing, i only knew nodejs, no sql, no react etc
and then I kept learning, and added new tools into my belt and started offering those services
you can start with something like WordPress.. make yourself proficient in it, there's really good demand of WP in freelance industry
then you can work as well as learn new things and when you are confident enough, offer those new learned things as service as well
Thanks!
48
u/tetractys_gnosys May 21 '21
This is great. I'm also willing to help peeps if you get overwhelmed with requests!
I work Monday through Friday, 9ish to 6ish EST but I stop and help my junior at least once a day on all kinds of things. Docker, (S)CSS, Gulp, HTMl, PHP, Git, Unix command line, JS, etc.