DEV Community

Day-43 Interview Questions and Answers (Frontend + Node.js + JavaScript)

Tamilselvan K on June 25, 2025

1. What is the difference between a function declaration and function expression? Function Declaration: Declared with the function key...
Collapse
 
neurabot profile image
Neurabot

Great. Useful.

Cool. Great post.

When updating code of website files in management files cpanel, I have problems.

I don't easily automatically update them in browser. I must do it 1 time. After it, i must clean browser to show another upgrade of code of files. How should I easily update browser to easily program in internet ?

Related to your post, when I selected in my tasks, document. getelementByClassName rule to use DOM, it doesn't work. Why ?

That are my main questions.

Collapse
 
tamilselvan1812 profile image
Tamilselvan K

Thanks!

1️⃣ Browser not updating: Do Ctrl + F5 or use Inspect → Network → Disable cache. Or add ?v=2 after file names to force update.

2️⃣ getElementByClassName error: It should be getElementsByClassName() (with "s"). Example:

document.getElementsByClassName("class")[0]  
Enter fullscreen mode Exit fullscreen mode

Or use:

document.querySelector(".class")  
Enter fullscreen mode Exit fullscreen mode

Hope this helps!

Collapse
 
neurabot profile image
Neurabot • Edited

Thanks much.

I have another problem. When developing, I notice that my in CSS files @media only screen propertie doesn't implement in browser. But in html files where i merge CSS codes, @media only screen propertie works. Why ?

This situation discourages me to not separate CSS codes from HTML or Javascript files.

Thread Thread
 
tamilselvan1812 profile image
Tamilselvan K

If media queries work inline but not in external CSS, it’s usually due to a wrong file path, browser cache, or a small syntax error. Media queries work perfectly in external CSS when linked correctly. Keeping CSS separate is always best practice for clean and scalable code.

Thread Thread
 
neurabot profile image
Neurabot

I will also try anyway.

May be I must visit browser cache. I don't roughly think it's syntax, neither path. file.

Collapse
 
oculus42 profile image
Samuel Rouse • Edited

Thanks for putting this together! I have a couple of notes/details that may not be necessary for most cases, but could help better paint a picture for some.

#13: The missing word here is context: the this keyword is the context the function runs in. For a method on an object, it is the "source" object. For an arrow-function, it is the context it was created in.

#14: These descriptions of null and undefined are more convention than design. Earlier conventions used null specifically to represent an object placeholder and used undefined to represent a missing primitive value. Optional chaining (?.) further blurs this line as it returns undefined.

#20: While your description is a pretty common response, it's not accurate. A closure is the combination of the function and its "scope" (lexical environment).. Every function creates a closure, but we don't usually have to think about that outside of these "special" cases.

#35: One additional difference of var is that it can be re-declared and has no temporal dead zone. let and const will throw an error if you declare the same variable twice. This is a very small addition, but it used to be pretty important in the days before modules, when you might write var myVar = myVar || new Thing();

Collapse
 
tamilselvan1812 profile image
Tamilselvan K • Edited

Thanks for putting this together! This is a solid overview. I have a few notes that might help refine or expand some of the points for readers who want a deeper understanding:

13: The missing word here is context. The this keyword refers to the context in which the function runs. For methods on an object, it refers to the "source" object. For arrow functions, this is lexically bound — meaning it retains the context of where the function was created.

14: The distinctions between null and undefined are more about convention than strict design. Historically, null was meant to represent an intentional absence of an object, while undefined indicated a missing primitive value. Modern JavaScript blurs this a bit — for example, optional chaining (?.) returns undefined when something doesn't exist.

20: The common explanation of closures as something "special" isn't entirely accurate. A closure is simply the combination of a function and its lexical environment (the scope in which it was created). Every function in JavaScript forms a closure, but we usually only have to think about closures explicitly when functions are returned, passed, or invoked in a different context than where they were created.

35: One more subtle but important difference with var is that it can be re-declared without throwing an error, unlike let and const, which will throw if you try to declare the same variable twice in the same scope. This was especially relevant before modules became common — patterns like var myVar = myVar || new Thing(); were often used as safeguards.

Thanks again for this write-up — it’s a helpful resource!

Collapse
 
oculus42 profile image
Samuel Rouse

I'm confused by this response. It seems like you used an LLM to re-write/re-state my comment? I'm not opposed to any additional clarification, but it seemed odd.

Also, you can avoid the number sign from becoming an H1 using a backslash, i.e. \#13

Thread Thread
 
tamilselvan1812 profile image
Tamilselvan K • Edited

Thanks for pointing that out — that's a totally fair observation. You're right, I structured my reply that way mainly to make sure I responded to each of your points clearly, but I can see how it might've come across as just rephrasing your comment rather than engaging further.

I genuinely appreciate the clarifications you provided, especially around closures and the history behind null and undefined. Those nuances definitely add value and help others reading this. Also, thanks for the markdown tip with # — that’s super helpful!

I'll keep this in mind for future replies. Appreciate you taking the time to share this!

Collapse
 
nevodavid profile image
Nevo David

damn, that’s a ton packed in one spot, super handy tbh - you ever wish someone taught you this all at once instead of bits and pieces?

Collapse
 
tamilselvan1812 profile image
Tamilselvan K

Absolutely, I completely agree. Having all this information consolidated in one place would have been incredibly helpful early on, rather than learning it in fragments over time. That said, the process of figuring things out piece by piece has certainly strengthened problem-solving skills along the way.

Collapse
 
kevenrussel61723 profile image
Keven_Russel61

This is impressive

Collapse
 
tamilselvan1812 profile image
Tamilselvan K

Thank you.

Collapse
 
dotallio profile image
Dotallio

This is such a handy reference, honestly covers so much ground for quick interview prep! Have you thought about adding some trickier or real-world scenario questions next?

Collapse
 
tamilselvan1812 profile image
Tamilselvan K

Thanks a lot! Great idea — I’ll definitely add some real-world and trickier questions soon.

Collapse
 
nathan_tarbert profile image
Nathan Tarbert

This is extremely impressive, I've enjoyed all of the research you've put into this project - it adds up

Collapse
 
tamilselvan1812 profile image
Tamilselvan K

Thank you so much! I really appreciate your feedback. Glad to hear the research and effort are adding value.