This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import platform | |
myos = platform.system() | |
if myos == "Windows": | |
print(subprocess.Popen(["netsh", "wlan", "show", "network"])) | |
elif myos == "Linux": | |
subprocess.Popen(["nmcli", "dev", "wifi"]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var array = [1,2,3,4,4,5,6,21,32,1] | |
var values = array.map(v => v + 1); | |
// Value of "values" variable : [2, 3, 4, 5, 5, 6, 7, 22, 33, 2] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function check() { | |
try { eval("var check = (x)=>x+1"); } | |
catch (e) { return false; } | |
return true; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Browser{ | |
constructor(color) { | |
this.name = 'Medium'; | |
this.color = color; | |
} | |
sayName() { | |
console.log('Hi, This site is '+ this.name+ '.'); | |
} | |
sayColor() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var javascript = "is better than PHP." | |
console.log(`${javascript}`); | |
// Result in console : is better than PHP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var treatment = {stayathome:"get rid of the corona",and:"don't go out"} | |
// Object Destructuring | |
var {stayathome,and} = treatment | |
// Normal | |
var stayathome = treatment.stayathome | |
var and = treatment.and |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function earn(mymoney,earned){ | |
return mymoney+earned | |
} | |
export var mymoney=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {earn,mymoney } from "folder/my_module.js"; | |
console.log(mymoney); | |
// Result in console : 1 | |
console.log(earn(11,5)) | |
// Result in console : 16 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// with normal variable | |
var login = true | |
login = false; | |
console.log(login) // it returns false | |
// with const variable | |
const login = true | |
login = false | |
// it returns error named Assigment to content variable. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const products = [ | |
{ name: 'IPhone X', price:"700$" }, | |
{ name: 'Another Phone', price:"500$"}, | |
] | |
for(const item of products){ | |
console.log(`Name : ${item.name}, Price ${item.price}`) | |
} |
OlderNewer