Basic Knowledge About Javascript

Basic Knowledge
console.log(2); 
console.log(“Hi”);
console.log(undefined);
console.log({});
console.log([]);
console.log(x => x * 2);
const friends = { name: “sakib”, age: 20 };console.log(friends.baby);
//output: undefind

Hello programmers… attention, please!!

console.log({});
console.log([]);
console.log(y => y* 5);
console.log(typeof(8)); // “number”
console.log(typeof(“Ahsan Ullah”)); // “string”
const friends = [{ name: “sakib”, age: 20 }];try {console.log(friendss);} catch (error) {console.log(error.message);}
//output error message: friendss is not defined.
const friends = [{ name: “sakib”, age: 20 }];try {console.log(friends.baby);if (!friends.baby) {throw new SyntaxError(“This is my error”);}} catch (error) {console.log(error.name, error.message);}
//output: SyntaxError This is my error
var number = 1;
let name = "Ahsan;
const friend = "sakib";
function getBabyName(condition) {
if (condition) {
var babyName = 'babu'
return babyName
} else {

return 'baby is not found'
}
}
function getBabyName(condition) {var babyName; 
if (condition) {
babyName ="babu"
return babyName
} else {
//babyName accessable from here
return 'baby is not found'
}
//babyName accessable from here
}
function getBabyName(condition) {function getBabyName(condition) {
if (condition) {
let babyName = 'babu'
return babyName
} else {
//don't accessible babyName from here
return 'baby is not found'
}
//don't accessible babyName from here
}
let numbers= [6, 10, 21]
console.log(...numbers)
//output: 6 10 21
// lets create function  that add two numbers with our old system:
function add(x, y) {
return x+ y
}
console.log(add(21, 10)) //31

// same function using arrow function , where x and y are function parameter:
let add2 = (x, y) => {
return x+y;
}
console.log(add2(21, 10)) // 31

--

--

--

I am a web developer. I have excellent skills in web development. Worked in HTML, CSS3, Reactjs,Nextjs, Javascript, TypeScript, Bootstrap, and MaterialUI.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Asynchronous Javascript — Exploring the other side of JS.

Integrate relay hook in expo app

Ways To Pass Props In React

Custom Component in React-Native

How To Create Custom AppBar With CustomPaint In Flutter

A Toe in TypeScript

My TS errors

Bringing the simplicity of React to your entire stack.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ahsan Ullah

Ahsan Ullah

I am a web developer. I have excellent skills in web development. Worked in HTML, CSS3, Reactjs,Nextjs, Javascript, TypeScript, Bootstrap, and MaterialUI.

More from Medium

Virtual DOM in ReactJS

An Introduction to Props in React

ReactJs PropTypes

Deep in JavaScript