decodeURIComponent try catch

by Christopher O

HTML

<div id="app">
    <p v-for="todo in todos">{{dEcOdE(todo)}}<br><br></p>
</div>

CSS

body {
  background: #20262E;
  padding: 20px;
  font-family: Helvetica;
}

#app {
  background: #fff;
  border-radius: 4px;
  padding: 20px;
  transition: all 0.2s;
}

li {
  margin: 8px 0;
}

h2 {
  font-weight: bold;
  margin-bottom: 15px;
}

del {
  color: rgba(0, 0, 0, 0.3);
}

Vue

new Vue({
    el: "#app",
    data: {
        todos: [
            "Hi, are we the 1 of the gods? Let's get that $$ if not -)",
            "Hi, are we the 1% of the gods? Let's get that $$ if not %-)",
            "Hi%2C%20are%20we%20the%201%25%20of%20the%20gods%3F%20Let%27s%20get%20that%20%24%24%20if%20not%20%25-%29",
        ]
    },
    methods: {
        dEcOdE: function(what) {
            try {
                return decodeURIComponent(what);
            } catch (e) {
                return what;
            }
        }
    }
})