Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
i am facing issue when using backticks , The browser show it string,
example:
<h2>${item.title}</h2>
Output:
${item.title}
I don't know where to using this. but simply you can use backticks like this.
In HTML
<div id="title"></div>
In Javascript
const titleTag = `<h2>${item.title}</h2>`;
const element = document.getElementById("title");
element.innerHTML = titleTag;
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I'm trying to import the Observable class and the interval method and it's giving it to the terminal
help
You don't need to use the Observable prefix. So just remove it:
let time = interval(500);
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
This regular expression is not working as expected.Please suggest other way to validate this regular expression in javascript.
var patt = new RegExp('^(PK\d{2}[A-Z]{4}\d{16})|(\d{9,20})$');
patt.test('PK12FKIE1234567890123456');
You need put both patterns inside a single group so that the anchors should apply to both.
var patt = /^(?:(PK\d{2}[A-Z]{4}\d{16})|(\d{9,20}))$/;
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I'm trying to learn regex. I need to find +46 and replace it with 0. I've been racking my brain but I can't figure out the correct syntax. I'm trying to do it in JS with replace.
Any takers?
Use .replace():
"987654321+46".replace("+46", "0")
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
i need to match string with "adwords**" except adwordsPE
my input
adwordsPW
adwordsPE
adwordsWE
need to output
adwordsPW - true
adwordsPE - false
adwordsWE - true
Try with:
adwords(?!PE)[A-Z]{2}
DEMO
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I'm trying to have my numbers in a format that is easier for the user to read.
Eg. Instead of: 12349568483, it would be: 12 349 568 483.
I was wondering if there is a simple way to do this?
var a = "12349568483";
a = a.split('').reverse().join('').replace(/([0-9]{3})/g, "$1 ").split('').reverse().join('');