Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module.exports = (string) => {
- let formatted = [];
- let i = 0;
- while(i < string.length) {
- if (string[i] === 'b') {
- formatted.push({'b': 123});
- } else {
- formatted.push({[string[i]: 456}});
- }
- i ++;
- }
- return formatted;
- }
- const charValueMatcher = require('./charValueMatcher');
- console.log(charValueMatcher('ManyLettersandbitsAndThings'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement