Random JavaScript question

kittenSolved! Special thanks to @Japh and John Blackbourne for figuring out where I went wrong 🙂

I’m trying to abstract some strings from a JavaScript file, but I can’t get it to work. I’m hoping some kind soul somewhere out there on the interwebz can tell me what stupidly obvious thing I am missing.

The code is buried in something which is manipulating a Backbone.js script. No matter what I do, I can’t use a variable with the “routes” section and am not sure how to work around that. You can see an example with the “blabla” variable below:

var blabla = 'boober';
 
// Sets up the routes events for relevant url queries
themes.Router = Backbone.Router.extend({
 
	routes: {
		blabla: 'this should be a boober',
		'test': 'test',
		'another-test': 'yes it is a test'
	},

Any ideas on how this works and how I can go about working around it?

I don’t really understand the syntax used there, which is probably not helping my understanding of it :/

Big thanks to anyone who is able to assist me in figuring this out 🙂

2 thoughts on “Random JavaScript question


  1. var blabla = 'boober';
    var my_routes = {
    'test': 'test',
    'another-test': 'yes it is a test'
    };
    my_routes[blabla] = 'this should be a boober';

    // Sets up the routes events for relevant url queries
    themes.Router = Backbone.Router.extend({

    routes: my_routes,

  2. Thank you!

    I just figured out the answer about 60 seconds ago via @Japh (his response was the same as yours).

    I’m updating the post right now to say it’s solved now. Thanks for helping out 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *