Skip to main content


 

Blake made me make a polished up version of this one. #art
Image/photo
#art

slartibartfast reshared this.

Nope. It's not pusheen & popeen. It's shifting & unshifting. push adds an element to the end of an array, pop removes an element from the end of an array. Unshift adds an a item to the top of an array, and shift removes the element from the top of an array.


shift: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift
uhshift: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift

push: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push
pop: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop

In python list.pop(0) will remove an item from the top of a list, but list.insert(<index>, <item>) will insert an item and list.append(<item) will add it to the end of the list.

I could go sets in python, but I think you get the jist. This just isn't pushing & poping.

I guess I visualize stacks different. Usually when you print a list it prints lowest to highest.

I think you meant to say "sorry for the mansplain, I'll do a dang Google search myself first next time"

Gender had nothing to do with it. This has nothing to do with genitalia. I didn't even consider it when I wrote the post. print_r(), pformat() and even console.log() will all show an array from left to right or top to bottom. json formats it that way as well. So there are millions of examples where arrays/lists are visualized top to bottom. Sorry for my mistake. Good day.

This website uses cookies. That said, social.linuxlusers.com only uses cookies/tracking within the constraints of what the Friendica project requires to function! No additional JavaScript or tracking code of any kind has been added to this site! We will never sell/release data without valid court order, and we only log what is needed to securely & legally operate the site.