Posts

docker

build sudo docker build -t name . run sudo docker run -it -p  hostport:builtinport name detached mode run sudo docker run -d -p 9000:3000 name see all running sudo docker ps up and listen sudo docker run -it -p 9000:3000 -v "$(pwd)":/appNew name list all images sudo docker images

compare arrays in javascript

there is no native method in js to compare 2 arrays. solution is to first sort the array and then convert to strings and then compare strings. var a1 = [ 1 , 2 , 3 ]; var a2 = [ 1 , 2 , 3 ]; console . log ( a1 == a2 ); // Returns false newa1 = a1.sort(); newa2 = a2.sort(); console . log ( JSON . stringify (new a1 )=== JSON . stringify (new a2 )); // Returns true