Is this possible to insert to localstorage or is there other way to store this?
$(\'#pass_to_score\').on(\'click\',function(){
var compressed = function(){
I don't know why you'd want that, I would not recommend it, but you can do it using toString.
Store it:
var myFunc = function (){
alert('Hello world!');
};
// Store it as a String
localStorage.setItem('compressedFunc', myFunc.toString());
Later, retrieve it:
var compressedFunc = localStorage.getItem('compressedFunc');
// Convert the String back to a function
var myFunc = eval('(' + compressedFunc + ')');
// Use it
myFunc();