1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ra1l [238]
3 years ago
13

Write JavaScript code to declare a variable of the name favoriteColor

Computers and Technology
1 answer:
Zinaida [17]3 years ago
8 0

Answer:

Variables are used to store values (name = "John") or expressions (sum = x + y).

Declare Variables in JavaScript

Before using a variable, you first need to declare it. You have to use the keyword var to declare a variable like this:

var name;

Assign a Value to the Variable

You can assign a value to the variable either while declaring the variable or after declaring the variable.

var name = "John";

OR

var name;

name = "John";

Explanation:

thats what i found sorry if it wrong

:D

You might be interested in
Write an expression using a variable that shows how much 3 pairs of jeans will cost if you do not know the price of the jeans.as
stich3 [128]
Maybe y = 3 * x, that is my guess
8 0
3 years ago
I want to know why almost every single "expert answer verified" thing I come across is wrong. If it's wrong, why the h is it exp
Studentka2010 [4]

Answer:

Because people just give out the verified things to the first person to answer their question

Explanation:

3 0
3 years ago
Read 2 more answers
Identify the characteristics of syntax errors. Choose all that apply.
kodGreya [7K]

Answer:

Explanation:

Identify the characteristics of syntax errors. Choose all that apply.

programmer did not follow the program language conventions

may be highlighted while writing the program

can be caused by mistyping or misspelling while writing the program

8 0
3 years ago
Read 2 more answers
6.10.1: Modify a C string parameter. Complete the function to replace any period by an exclamation point. Ex: "Hello. I'm Miley.
Andrej [43]

Answer:

#include <iostream>

#include <cstring>

using namespace std;

void replacePeriod(char* phrase) {

int i = 0;

while(*(phrase + i) != '\0')

{

if(*(phrase + i) == '.')

*(phrase + i) = '!';

i++;

}

}

int main() {

const int STRING_SIZE = 50;

char sentence[STRING_SIZE];

strcpy(sentence, "Hello. I'm Miley. Nice to meet you.");

replacePeriod(sentence);

cout << "Updated sentence: " << endl;

cout << sentence << endl;

return 0;

}

Explanation:

  • Create a function called replacePeriod that takes a pointer of type char as a parameter.
  • Loop through the end of phrase, check if phrase has a period and then replace it with a sign of exclamation.
  • Inside the main function, define the sentence and pass it as an argument to the replacePeriod function.
  • Finally display the updated sentence.
6 0
3 years ago
Find the error and rewrite the code with the error fixed.
kap26 [50]

Answer:

Explanation:

1st mistake: Barcode is written with upeer case, that's not the convention for variables in java, only classes.

2nd: Barcode is public, it is convention to always leave variables private then create getters and setters in case you need to change the value but never acess the variable outside the class it belongs. Also the class should at least have a default constructor in case you are going to instantiate an object outside it.

so the product class should be:

--------------------------------------------------------------------

public class Product {

private int barcode;

        public Product() {

        // default constructor

        }

public int getBarcode() {

 return barcode;

}

public void setBarcode(int barcode) {

 this.barcode = barcode;

}

}

-------------------------------------------------------------------------

3rd: in the main class now you can instantiate the 2 objects but you are gonna set the variable and get the value through the method, like this:

public class Main {

 

public static void main(String[] args) {

   

 Product prod1 = new Product();

 prod1.setBarcode(123456);

 Product prod2 = new Product();

 prod2.setBarcode(987654);

 System.out.println(prod1.getBarcode());

 System.out.println(prod2.getBarcode());

}

}

-----------------------------------------------------------------------------------

Assuming the 2 classes (main and product) are in the same package. But in case they are in different packages, just make sure to import the Product class into the Main class so that you can instantiante an object (new Product()) of it.

7 0
3 years ago
Other questions:
  • The salespeople at hyperactive media sales all use laptop computers so they can have easy access to important data on the road.
    9·1 answer
  • This is not an appropriate business use for a wiki. editing corporate documents getting customer feedback project management pub
    11·1 answer
  • The Internet of Things (IoT) is a global information architecture that could contain
    12·1 answer
  • 38. To select nonadjacent items, select the first item, such as a word or paragraph, as usual; then, press and hold down the ___
    8·1 answer
  • A(n) ________ is a navigation aid that shows the path you have taken to get to a web page or where the page is located within th
    5·2 answers
  • Chapter 21 discusses four aspects of the speaking situation you should take into account when planning the graphics you'll use i
    15·1 answer
  • Which of the following is a tip for making sure you are messaging safely?
    5·1 answer
  • 49 points!
    14·1 answer
  • Which of the following responses is the best example of a problem that can be solved using a computer program?
    6·2 answers
  • Who benefits the most from billing by the second for cloud resources, such as virtual machines?.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!