Sure! Here's an example of a simple neural network class in pure JavaScript:

```javascript
class NeuralNetwork {
  constructor(input_nodes, hidden_nodes, output_nodes, learning_rate) {
    this.input_nodes = input_nodes;
    this.hidden_nodes = hidden_nodes;
    this.output_nodes = output_nodes;
    this.learning_rate = learning_rate;

    // Initialize weights
    this.weights_ih = new Matrix(this.hidden_nodes, this.input_nodes);
    this.weights_ho = new Matrix(this.output_nodes, this.hidden_nodes);
    this.weights_ih.randomize();
    this.weights_ho.randomize();

    // Initialize biases
    this.bias_h = new Matrix(this.hidden_nodes, 1);
    this.bias_o = new Matrix(this.output_nodes, 1);
    this.bias_h.randomize();
    this.bias_o.randomize();
  }

  feedforward(input_array) {
    // Generate hidden layer
    let inputs = Matrix.fromArray(input_array);
    let hidden = Matrix.multiply(this.weights_ih, inputs);
    hidden.add(this.bias_h);
    hidden.map(sigmoid);

    // Generate output layer
    let output = Matrix.multiply(this.weights_ho, hidden);
    output.add(this.bias_o);
    output.map(sigmoid);

    return output.toArray();
  }

  train(input_array, target_array) {
    // Feedforward
    let inputs = Matrix.fromArray(input_array);
    let hidden = Matrix.multiply(this.weights_ih, inputs);
    hidden.add(this.bias_h);
    hidden.map(sigmoid);

    let outputs = Matrix.multiply(this.weights_ho, hidden);
    outputs.add(this.bias_o);
    outputs.map(sigmoid);

    // Backpropagation
    let targets = Matrix.fromArray(target_array);
    let output_errors = Matrix.subtract(targets, outputs);
    let hidden_errors = Matrix.multiply(Matrix.transpose(this.weights_ho), output_errors);

    // Update weights and biases
    let gradients = Matrix.map(outputs, dsigmoid);
    gradients.multiply(output_errors);
    gradients.multiply(this.learning_rate);

    let hidden_T = Matrix.transpose(hidden);
    let weights_ho_deltas = Matrix.multiply(gradients, hidden_T);
    this.weights_ho.add(weights_ho_deltas);
    this.bias_o.add(gradients);

    let hidden_gradients = Matrix.map(hidden, dsigmoid);
    hidden_gradients.multiply(hidden_errors);
    hidden_gradients.multiply(this.learning_rate);

    let inputs_T = Matrix.transpose(inputs);
    let weights_ih_deltas = Matrix.multiply(hidden_gradients, inputs_T);
    this.weights_ih.add(weights_ih_deltas);
    this.bias_h.add(hidden_gradients);
  }
}

function sigmoid(x) {
  return 1 / (1 + Math.exp(-x));
}

function dsigmoid(y) {
  return y * (1 - y);
}
```



This example creates a `NeuralNetwork` class that takes in the number of input nodes, hidden nodes, output nodes, and learning rate as constructor arguments. It initializes weights and biases randomly, and provides methods for feedforward and training using backpropagation.

This implementation uses a `Matrix` class to perform matrix operations, which is not a built-in JavaScript feature. You can define the `Matrix` class yourself or use an existing library like `mathjs`.
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence