Programming Lang Idiosyncrasies and Similarities

Posted on September 2, 2022
Tags: codeetc

0.0.1 Destructuring

Changing property “size” to 3:

0.0.2 Case sensititivity

0.0.3 File naming

0.0.4 React

0.0.5 JS fetch

Try fetch request with no-cors If returns opaque response, it means cors is not allowed by the website

const res = fetch(https://bleh.com/examples/data/asset/data/tempdata.json,{mode: “no-cors”}).then((data)=>{console.log(data.body)})

If data.body is a readable stream, you first have to convert it to Know that .json() returns a promise so you have to pass it again

const res = fetch(https://bleh.com/examples/data/asset/data/tempdata.json,{mode: “no-cors”}).then((re)=>{return re.json()}).then(response => {console.log(response)})

1 Python arrays and references

a = [5]
b = a
b = [3]
print(a) #[3]
a = [5]
b = a
b = b + [3]
print(a) #[3]
a = [5]
b = a
b = b.append(3)
print(a) #[5,3]

Why is the last case different?