0% found this document useful (0 votes)
24 views3 pages

Javascript Cheatsheet For Python Devs

This document serves as a cheatsheet for Python developers transitioning to JavaScript, highlighting key differences in syntax and data types. It covers variables, data types, printing output, conditionals, loops, functions, arrays, dictionaries, and boolean logic. Each section provides equivalent examples in both languages for easy reference.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views3 pages

Javascript Cheatsheet For Python Devs

This document serves as a cheatsheet for Python developers transitioning to JavaScript, highlighting key differences in syntax and data types. It covers variables, data types, printing output, conditionals, loops, functions, arrays, dictionaries, and boolean logic. Each section provides equivalent examples in both languages for easy reference.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

JavaScript Cheatsheet for Python Developers

Variables

Python: x = 10

JavaScript: let x = 10; // or var x = 10; or const x = 10;

Data Types

Python: int, float, str, list, dict

JavaScript: number, string, boolean, array, object

Printing Output

Python: print('Hello')

JavaScript: [Link]('Hello');

Conditionals

Python:

if x > 5:

print('Big')

else:

print('Small')

JavaScript:

if (x > 5) {

[Link]('Big');

} else {

[Link]('Small');

Loops

Python:
JavaScript Cheatsheet for Python Developers

for i in range(5):

print(i)

JavaScript:

for (let i = 0; i < 5; i++) {

[Link](i);

Functions

Python:

def greet(name):

return 'Hello ' + name

JavaScript:

function greet(name) {

return 'Hello ' + name;

Arrays and Lists

Python: my_list = [1, 2, 3]

JavaScript: let myArray = [1, 2, 3];

Dictionaries vs Objects

Python: person = {'name': 'John', 'age': 30}

JavaScript: let person = {name: 'John', age: 30};

Null and Undefined

Python: None

JavaScript: null, undefined


JavaScript Cheatsheet for Python Developers

Boolean Logic

Python: and, or, not

JavaScript: &&, ||, !

You might also like