What will be the output of the following JavaScript code
Undefined.
This is due to hoisting. The code behaves like this π
var a; //the variable got hoisted
console.log(a); // Outputs: undefined
a = 5;
[We know when a declare a variable the initial value is "undefined" until we assign a value]
This is due to hoisting. The code behaves like this π
var a; //the variable got hoisted
console.log(a); // Outputs: undefined
a = 5;
[We know when a declare a variable the initial value is "undefined" until we assign a value]
π1
Forwarded from Learn Python with Python Video Tutorial Python Course Python Note Python Book Python PDF Django Flask Python
Answer: Exception
Solution:
class TV:
pass
creates a new data type called TV.
pass is just a no-operation statement, it doesn't add any data or functionality to the class.
Hence, this data type does not contain any attributes or functionality
obj = TV()
creates a new object named obj, of the data type TV.
obj.price = 200
creates a new variable named
The value of this variable is set to 200.
Finally, we have
print(self.price)
But there is no object named
Hence, we get an Exception stating that there is nothing called
But you'd have seen
It is simply a convention to use
the first parameter of the method.
The first parameter of a method is is the object through which the method was invoked.
Eg.
a = [1,2,3]
then
a.append(5)
is equivalent to
list.append(a, 5)
So here,
The name
conventionally used to refer to the implicit argument passed in methods.
Otherwise, the word
Hence, the code in the question gives an error, because
I hope this helped!
@python_assets
@javascript_resources
Solution:
class TV:
pass
creates a new data type called TV.
pass is just a no-operation statement, it doesn't add any data or functionality to the class.
Hence, this data type does not contain any attributes or functionality
obj = TV()
creates a new object named obj, of the data type TV.
obj.price = 200
creates a new variable named
price, within obj.The value of this variable is set to 200.
Finally, we have
print(self.price)
But there is no object named
self here!Hence, we get an Exception stating that there is nothing called
self.But you'd have seen
self in other programs elsewhere.self is not a keyword or pre-defined variable in Python.It is simply a convention to use
self WITHIN methods to denotethe first parameter of the method.
The first parameter of a method is is the object through which the method was invoked.
Eg.
a = [1,2,3]
then
a.append(5)
is equivalent to
list.append(a, 5)
So here,
a is implicitly passed to the method append.The name
self isconventionally used to refer to the implicit argument passed in methods.
Otherwise, the word
self has no special meaning in Python.Hence, the code in the question gives an error, because
self is not defined before use.I hope this helped!
@python_assets
@javascript_resources
β€4π2
Practice these 125+ Algorithms in
@javascript_resources
@python_assets
β C++
β Java
β Python
β JavaScript
Or, any language of your choice
Stay in top 5% of programmers.
β©
β Array - Algorithms
β Creating an Array
β Iterate through Array
β Get an Element
β Search an Element
β Insert Element(s)
β Delete Element(s)
β Filter an Array
β Fetch a Sub-Array
β Merging Arrays
β Reverse Array
ββ Rotate Array
β Linked List - Algorithms [1]
β Creating a Linked List
β Iterate through Linked List
β Get an Element
β Find an Element
β€ Insert Element(s)
β At Start
β At End
β At Anywhere
β Linked List - Algorithms [2]
β€ Delete Element(s)
β From Start
β From End
β From Anywhere
ββ IsEmpty
ββ Merging Linked Lists
ββ Reverse Linked List
ββ Check for Cycles
β Stack - Algorithms
β Push
β Pop
β IsEmpty
β IsFull
β Peek
β Queue - Algorithms
β Enqueue
β Dequeue
β IsEmpty
β IsFull
β Peek
β Hash Table - Algorithms
β€ Hash Function
β Division Method
β Multiplication Method
β Universal Hashing
β€ Hash Collision
β Collision Resolution
β€ Open Addressing
β Linear Probing
β Quadratic Probing
β Double Hashing
β Tree - Algorithms
β Traversal
β Height of a Node/Tree
β Depth of a Node
β Degree of a Node
β€ Traversal
β In Order
β Pre Order
β Post Order
β Level Order
β Insert
β Delete
β Heap - Algorithms
@javascript_resources
@python_assets
β Heapify
β Insert Element
β Delete Element
β Peek (Max/Min Element)
β Extract (Max/Min Element)
β Graph - Algorithms [1]
β€ Adjacency Matrix
β Add Edge
β Remove Edge
β€ Adjacency List
β Add Edge
β Remove Edge
β€ Traverse Nodes
β Depth First Search
β Breadth First Search
β Graph - Algorithms [2]
β€ Shortest Path
β Dijkstra's Algorithm
β Floyd-Warshall Algorithm
β Bellman Ford Algorithm
β€ Minimum Spanning Tree
β Kruskal's Algorithm
ββ Prim's Algorithm
β Graph - Algorithms [3]
β€ Connectivity
ββ Check connectivity b/w nodes
ββ Find all paths
ββ Articulation points
ββ Bridges
ββ Hamiltonian Path
ββ Hamiltonian Cycle
ββ Eulerian Path
ββ Eulerian Cycle
20. Find # of islands
ββ Transitive Closure
β Graph - Algorithms [4]
@javascript_resources
@python_assets
ββ Graph Cycle
β€ Topological Sorting
ββ Find all topological sorting
ββ Kahn's Algorithm
ββ Longest Path
β€ Flow Network
ββ Ford-Fulkerson Algorithm
ββ EdmondsβKarp algorithm
ββ Dinic's Algorithm
β Search Algorithms
β Linear Search
β Jump Search
β Binary Search
β Interpolation Search
β Exponential Search
β Ternary Search
β Sorting Algorithms [1]
β Bubble Sort
β Selection Sort
β Insertion Sort
β Merge Sort
β Quick Sort
And, a few advanced ones,
β Binary Insertion Sort
β 3-way Merge Sort
β 3-way Quick Sort
β Counting Sort
β Radix Sort
ββ Bucket Sort
ββ Heap Sort
ββ Shell Sort
β Sorting Algorithms [2]
ββ Tim Sort
ββ Odd-Even Sort
ββ Comb Sort
ββ Cocktail Sort
ββ Tree Sort
ββ Cartesian Sort
20. Pigeonhole Sort
ββ Cycle Sort
ββ Strand Sort
ββ Pancake Sort
ββ Permutation Sort
ββ Gnome Sort
ββ Bitonic Sort
ββ Sleep Sort
@javascript_resources
@python_assets
@javascript_resources
@python_assets
β C++
β Java
β Python
β JavaScript
Or, any language of your choice
Stay in top 5% of programmers.
β©
β Array - Algorithms
β Creating an Array
β Iterate through Array
β Get an Element
β Search an Element
β Insert Element(s)
β Delete Element(s)
β Filter an Array
β Fetch a Sub-Array
β Merging Arrays
β Reverse Array
ββ Rotate Array
β Linked List - Algorithms [1]
β Creating a Linked List
β Iterate through Linked List
β Get an Element
β Find an Element
β€ Insert Element(s)
β At Start
β At End
β At Anywhere
β Linked List - Algorithms [2]
β€ Delete Element(s)
β From Start
β From End
β From Anywhere
ββ IsEmpty
ββ Merging Linked Lists
ββ Reverse Linked List
ββ Check for Cycles
β Stack - Algorithms
β Push
β Pop
β IsEmpty
β IsFull
β Peek
β Queue - Algorithms
β Enqueue
β Dequeue
β IsEmpty
β IsFull
β Peek
β Hash Table - Algorithms
β€ Hash Function
β Division Method
β Multiplication Method
β Universal Hashing
β€ Hash Collision
β Collision Resolution
β€ Open Addressing
β Linear Probing
β Quadratic Probing
β Double Hashing
β Tree - Algorithms
β Traversal
β Height of a Node/Tree
β Depth of a Node
β Degree of a Node
β€ Traversal
β In Order
β Pre Order
β Post Order
β Level Order
β Insert
β Delete
β Heap - Algorithms
@javascript_resources
@python_assets
β Heapify
β Insert Element
β Delete Element
β Peek (Max/Min Element)
β Extract (Max/Min Element)
β Graph - Algorithms [1]
β€ Adjacency Matrix
β Add Edge
β Remove Edge
β€ Adjacency List
β Add Edge
β Remove Edge
β€ Traverse Nodes
β Depth First Search
β Breadth First Search
β Graph - Algorithms [2]
β€ Shortest Path
β Dijkstra's Algorithm
β Floyd-Warshall Algorithm
β Bellman Ford Algorithm
β€ Minimum Spanning Tree
β Kruskal's Algorithm
ββ Prim's Algorithm
β Graph - Algorithms [3]
β€ Connectivity
ββ Check connectivity b/w nodes
ββ Find all paths
ββ Articulation points
ββ Bridges
ββ Hamiltonian Path
ββ Hamiltonian Cycle
ββ Eulerian Path
ββ Eulerian Cycle
20. Find # of islands
ββ Transitive Closure
β Graph - Algorithms [4]
@javascript_resources
@python_assets
ββ Graph Cycle
β€ Topological Sorting
ββ Find all topological sorting
ββ Kahn's Algorithm
ββ Longest Path
β€ Flow Network
ββ Ford-Fulkerson Algorithm
ββ EdmondsβKarp algorithm
ββ Dinic's Algorithm
β Search Algorithms
β Linear Search
β Jump Search
β Binary Search
β Interpolation Search
β Exponential Search
β Ternary Search
β Sorting Algorithms [1]
β Bubble Sort
β Selection Sort
β Insertion Sort
β Merge Sort
β Quick Sort
And, a few advanced ones,
β Binary Insertion Sort
β 3-way Merge Sort
β 3-way Quick Sort
β Counting Sort
β Radix Sort
ββ Bucket Sort
ββ Heap Sort
ββ Shell Sort
β Sorting Algorithms [2]
ββ Tim Sort
ββ Odd-Even Sort
ββ Comb Sort
ββ Cocktail Sort
ββ Tree Sort
ββ Cartesian Sort
20. Pigeonhole Sort
ββ Cycle Sort
ββ Strand Sort
ββ Pancake Sort
ββ Permutation Sort
ββ Gnome Sort
ββ Bitonic Sort
ββ Sleep Sort
@javascript_resources
@python_assets
π2β€1π₯1π1
JavaScript Operators cheatsheet
CSS Shorthand Properties
rate the logo πππ
π₯9π€1
Ten useful websites which can replace your Paid PC software (100% FREE)
1. Landingsite:
Build a website in a 60 seconds:
- Home Page Generation & Editing
- 150M+ Stock Photos
- Free Subdomain and Built-In SEO
- Traffic Analytics
landingsite.ai
Follow us on Telegram β https://t.me/javascript_resources
https://t.me/python_assets
2. Ezgif
Ezgif can do many things for you:
β’ Video to GIF
β’ Image converter
β’ Image optimizer
β’ Editing tools like resize, rotate, crop, cut, and split
Try now:
Ezgif.com
3. RemoveBG
RemoveBG easily removes image backgrounds with just a few clicks.
Try now:
remove.bg
Follow us on Telegram β https://t.me/javascript_resources
https://t.me/python_assets
4. Photopea
Photopea is a free web-based editor that replaces Adobe Photoshop and Illustrator.
Edit images, create illustrations, design for the web, or convert image formats.
Try now:
photopea.com
https://photopea.com
5. Nero AI:
Enlarge, improve, and clean up photos without quality loss.
Increase image resolution with this tool.
Try now: ai.nero.com/image-upscaler
6. Stockimg:
stockimgAI is a free tool for creating logos, stock images, wallpapers, and more in seconds.
Try it now: stockimg.ai
7. TinyWow:
Free AI Writing, PDF, image, and video editing tools.
Completely free with OCR, no registration needed.
Try now:
tinywow.com
8. VirusTotal:
Free online virus checker. Analyze files, domains, IPs, and URLs for malware.
Try now: virustotal.com/gui/home/upload
9. Synthesia AI
Use Synthesia AI to create professional videos from text in over 65 languages, saving you time and money.
Try it now at . synthesia.io
10. PDF Escape:
Best Adobe Acrobat alternative.
Edit, fill, view PDFs online with PDFescape.
Try now at . pdfescape.com
Follow us on Telegram β https://t.me/javascript_resources
https://t.me/python_assets
1. Landingsite:
Build a website in a 60 seconds:
- Home Page Generation & Editing
- 150M+ Stock Photos
- Free Subdomain and Built-In SEO
- Traffic Analytics
landingsite.ai
Follow us on Telegram β https://t.me/javascript_resources
https://t.me/python_assets
2. Ezgif
Ezgif can do many things for you:
β’ Video to GIF
β’ Image converter
β’ Image optimizer
β’ Editing tools like resize, rotate, crop, cut, and split
Try now:
Ezgif.com
3. RemoveBG
RemoveBG easily removes image backgrounds with just a few clicks.
Try now:
remove.bg
Follow us on Telegram β https://t.me/javascript_resources
https://t.me/python_assets
4. Photopea
Photopea is a free web-based editor that replaces Adobe Photoshop and Illustrator.
Edit images, create illustrations, design for the web, or convert image formats.
Try now:
photopea.com
https://photopea.com
5. Nero AI:
Enlarge, improve, and clean up photos without quality loss.
Increase image resolution with this tool.
Try now: ai.nero.com/image-upscaler
6. Stockimg:
stockimgAI is a free tool for creating logos, stock images, wallpapers, and more in seconds.
Try it now: stockimg.ai
7. TinyWow:
Free AI Writing, PDF, image, and video editing tools.
Completely free with OCR, no registration needed.
Try now:
tinywow.com
8. VirusTotal:
Free online virus checker. Analyze files, domains, IPs, and URLs for malware.
Try now: virustotal.com/gui/home/upload
9. Synthesia AI
Use Synthesia AI to create professional videos from text in over 65 languages, saving you time and money.
Try it now at . synthesia.io
10. PDF Escape:
Best Adobe Acrobat alternative.
Edit, fill, view PDFs online with PDFescape.
Try now at . pdfescape.com
Follow us on Telegram β https://t.me/javascript_resources
https://t.me/python_assets
Photopea
Photopea | Online Photo Editor
Photopea Online Photo Editor lets you edit photos, apply effects, filters, add text, crop or resize pictures. Do Online Photo Editing in your browser for free!
β€4π₯2π1
CSS Flexbox cheatsheet
π₯1
Atleast give some reaction on posts... ππ Not begging for money π°
π9π4π₯1π₯°1
