Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that uses regular expression 1. Replace the word Decimal to Binary 2. find all the numbers in the supplied string. Convert the

Write a program that uses regular expression 1. Replace the word Decimal to Binary 2. find all the numbers in the supplied string. Convert the numbers to binary numbers. Using regular expression replace method to replace the numbers in the string with the converted binary numbers. (0b represents a binary number, as example binary number 0b10 is decimal number 2) You may perform the conversion in 2 separate steps. (Hint: You may modify the following example from the textbook: let s = "the cia and fbi"; console.log(s.replace(/\b(fbi|cia)\b/g, str => str.toUpperCase())); // the CIA and FBI Find all the numbers. Use toString(2) to convert the decimal number to binary.) The string: In Decimal, 2 plus 4 is 6 and 12 minus 7 is 5 The converted string: In Binary, 0b10 plus 0b100 is 0b110 and 0b1100 minus 0b111 is 0b101

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Explain the functions of financial management.

Answered: 1 week ago

Question

HOW MANY TOTAL WORLD WAR?

Answered: 1 week ago

Question

Discuss the scope of financial management.

Answered: 1 week ago

Question

Discuss the goals of financial management.

Answered: 1 week ago