Hi 345ishaan
Sorry for the late response, I saw that you are using the example in this link, so it seems to be fine. But it doesn't seem that this have been tested in an Edison Board yet.
I suggest you to use the MRAA library.I haven't found examples for SPI using javascript but in that link you will find all the functions that you can use. Take a look at it.
Regards;
CMata