DEV Community

KIRUBAGARAN .K
KIRUBAGARAN .K

Posted on

Front-End Interview Questions Basic

1.Java and JavaScript

java

  • A programming language used to build applications like Android apps, enterprise software, banking systems, etc.

  • Runs on JVM (Java Virtual Machine)

  • Strict, strongly typed (you must specify data types)

javaScript

  • A scripting language mainly used to make websites interactive (front-end & back-end).

  • Runs in web browsers and also on servers using Node.js

  • Loose, dynamically typed (no need to specify data types)

  1. *Function and Arrow Function *

Function

  • A function is a block of code defined using the function keyword that can be called anytime to perform a task

  • It has its own this, arguments, and is hoisted.

Example:

function add(a, b) {
  return a + b;
}

Enter fullscreen mode Exit fullscreen mode

Arrow Function

  • An arrow function is a shorter and modern way to write functions using the => arrow syntax

  • It does not have its own this or arguments, and it is not hoisted.

Example:

const add = (a, b) => a + b;

3.var let const

var

  • var is the old way of declaring variables in JavaScript. It is function-scoped, can be redeclared, and can be updated.

var x = 10;
x = 20;

var x = 30;

  • Old variable declaration

  • Function scope

  • Re-declare > Yes

  • Update value > Yes

  • Use Case > Older code, not recommended

let

  • let is the modern variable declaration. It is block-scoped, cannot be redeclared in the same block, but can be updated.

let y = 10;
y = 20;

let y = 30;

  • Modern variable declaration

  • Block scope

  • Re-declare > no

  • Update value > Yes

  • Use Case > Normal variables

const

  • const is used to declare constants. It is block-scoped, cannot be updated, cannot be redeclared

const z = 10;
z = 20;

  • Constant variable declaration

  • Block scope

  • Re-declare > no

  • Update value > no

  • Constant values

4.HTML and CSS

HTML

  • HTML (HyperText Markup Language) HTML is used to create the structure of a webpage. It decides what content appears on the page

** Example:**

  • Headings
  • Paragraphs
  • Images
  • Buttons
  • Forms
<h1>Hello World</h1>
<p>This is a paragraph.</p>
Enter fullscreen mode Exit fullscreen mode

CSS

-CSS (Cascading Style Sheets)

  • CSS is used to style the webpage.

  • It decides how the content looks.

Example:

  • Colors
  • Fonts
  • Layout
  • Height & width
  • Backgrounds
h1 {
  color: blue;
  font-size: 30px;
}

Enter fullscreen mode Exit fullscreen mode

5.ID and Class Selector

ID

  • An ID is a unique name given to a single HTML element

  • Used when you want to style only one specific element.

  • Symbol in CSS (#)

  • Special elements (header, footer, section)

HTML

<div id="header">Home</div>

**CSS**
#header {
  color: blue;
}

Enter fullscreen mode Exit fullscreen mode

Class

  • A class is used to style multiple elements with the same design.

  • Used when you want to apply the same style to more than one element

  • Symbol in CSS (.)

  • Repeated styling (buttons, titles, cards)

HTML

<div class="header">Home</div>

**CSS**
.header {
  color: blue;
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)