how can i make this function correctly fulfill what they are asking me for?

Iterate in a loop, increasing the received number by 2, up to a limit of 10 times. Save each new value in an array and return it. If at any point the sum value and the number of iterations coincide, the execution should be interrupted, and the string “Execution was interrupted” should be returned.

I have tried to make this function fulfill what they are asking me for, I have tried many ways but it only fulfills one of the two functions

This is the code

function breakStatement(num){
const nuevosValores = [];

  for (let i = 0; i < 10; i++) {
    num += 2
    nuevosValores.push(num);

    if (num === i) {
      console.log('se interrumpe la ejecucion del programa');
      break;
  }

}return nuevosValores;
}

console.log(breakStatement(-4));

i tried to loops while and for, but cant find the solution for this enunciated.

i get from the console this.

when the parameter is
console.log(breakStatement(-4));

Expected: “interrupted execution”
Received: [-2, 0, 2, 4, 6, 8, 10, 12, 14, 16]

and, when the parameter is
console.log(breakStatement(50));

Obtain a:

Expected: [52, 54, 56, 58, 60, 62, 64, 66, 68]
Received: undefined

Run Function on ever click (New to Javascript)

Hi i have a javascript file that io want to run everytime a button is clicked in my HTML, at the moment this is refreshing the page but want it to run the javascript file below;

HTML

<h1>Refresh Me</h1>
      <div><button onclick="window.location.reload()" type="button" class="button">Let's Find Out</button></div>

javascript

var randomNumber1 = Math.floor(Math.random()*6)+1;
var randomDiceImage = "dice"+randomNumber1+".png";
var randomImageSource = "images/"+randomDiceImage;
var image1 = document.querySelectorAll('img')[0].setAttribute("src",randomImageSource);

var randomNumber2 = Math.floor(Math.random()*6)+1;
var randomDiceImage2 = "dice"+randomNumber2+".png";
var randomImageSource2 = "images/"+randomDiceImage2;
var image2 = document.querySelectorAll("img")[1].setAttribute("src",randomImageSource2);

    

if(randomNumber1 > randomNumber2){
document.querySelector("h1").innerText = "Kirsty Makes Tea";
}
else if(randomNumber1 < randomNumber2){
document.querySelector("h1").innerText= "Danny Makes Tea";
}else{
    document.querySelector("h1").innerText= "Its a draw";
}

Tried On Click and element listener but possibly incorrectly

Can I get a callable reference to an operator?

Is there a way to get a callable reference to an operator (such as ===) in TypeScript?

The motivation is this function:

function dedup<T>(values: T[], equals: (a: T, b: T) => boolean): T[] {
  return values.reduce<T[]>((prev, cur) => {
    if (prev.filter((value) => equals(value, cur)).length == 0) prev.push(cur);
    return prev;
  }, []);
}

This returns an array with duplicates removed, with equality of items defined by the equals function passed in. But if I just want to use === as equals, then I have to construct a completely superfluous anonymous function:

dedup([1, 2, 3, 2], (a, b) => a === b)

I’d like to be able to call it like this:

dedup([1, 2, 3, 2], ===)

or words to that general effect, but I can’t figure out how to get a callable reference to an operator such as ===.

supabase filter large numbers with gte

how are you? Im creating a store using nextjs pages router and supabase. When using filters to fetch my products, I found a bug. The gte filter doesn’t work okay with numbers with more than 4 digits. (example: 11000)

My api route goes like this:

async function handler(req: NextApiRequest, res: NextApiResponse) {
  if (req.method !== "POST") {
    // Return an error response for unsupported request methods
    res.status(405).json({ error: "Method Not Allowed" });
    return;
  }


  const {
    minPrice,
    maxPrice,
    oferta,
    garment,
    category,
    search,
  }: {
    minPrice: number | undefined | null;
    maxPrice: number | undefined | null;
    oferta: string | undefined | null;
    garment: string | undefined | null;
    category: string | undefined | null;
    search: string | undefined | null;
  } = req.body;

  let query = supabase
    .from("products")
    .select(
      "seller!inner( status ), id, published, published_version, created_at"
    )
    .eq("suspended", "false")
    .eq("published", "true")
    .eq("seller.status", "live");

  if (oferta === "si") {
    query = query.neq("published_version->>offer_price", "");
  }

  if (oferta === "no") {
    query = query.eq("published_version->>offer_price", "");
  }

  if (category) {
    query = query.eq("published_version->category->>main", category);
  }

  if (garment) {
    query = query.eq("published_version->category->>garment", garment);
  }

  if (minPrice) {
    console.log("minPrice", minPrice);
    query = query.gte("published_version->>price", minPrice);
  }

  // we fetch the products with the filters applied and order them

  query = query.order("created_at", { ascending: false }).limit(50);

  const { data, error } = await query;

  if (error || !data) {
    console.log("ERROR", error);
    res.status(500).json({ error: error.message });
  }

  const products = data?.map((product) => {
    return {
      ...product,
      data: {
        ...product.published_version,
      },
    };
  });

  res.status(200).json({ data: products });
}

Everything works fine except for the minPrice and maxPrice filter. I cant filter with a number greater than 9999.

Can somebody help me? Thanks!

Close modal if clicked outside of modal but not if you click on the prev or next links

I would like the modal box to close if you click outside of .modal but not if you click on the prev or next links, I am having trouble with that last part. I am not sure how to prevent the modal from closing if the prev or next links are clicked. The next buttons will be scrolling through different boxes so I need them clickable. Any help is appreciated.

window.addEventListener('load', setup);

const get = document.getElementById.bind(document);
const query = document.querySelector.bind(document);

function setup() {
  
  let modalRoot = get('modal-root');
  let button = get('modal-opener');
  let modal = query('.modal');
  
  modalRoot.addEventListener('click', rootClick);
  button.addEventListener('click', openModal);
  modal.addEventListener('click', modalClick);
  
  function rootClick() {
    modalRoot.classList.remove('visible');
  }
  
  function openModal() {
    modalRoot.classList.add('visible');
  }
  
  function modalClick(e) {
    e.preventDefault();
    e.stopPropagation();
    e.stopImmediatePropagation();
    return false;
  }
  
}
#modal-root {
  position: fixed;
  overflow: hidden;
  background-color: rgba(0, 0, 0, 0.4);
  left : 0;
  top: 0;
  width: 0px;
  height : 0px;
  opacity: 0;
  transition: opacity 0.15s ease-out, width 0s linear 0.15s, height 0s linear 0.15s;
}

#modal-root.visible {
  width: 100%;
  height: 100%;
  opacity: 1;
  transition: opacity 0.15s ease-out;
}

.modal {
  margin: 0 auto;
  width: 40%;
  background-color: white;
  padding: 20px;
  border-radius: 5px;
  position: relative;
  top: 50%;
  transform: translateY(-50%);
}
.prevslide, .nextslide{
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -50px;
    color: red;
    font-weight: 700;
    font-size: 20px;
    transition: .6s ease;
    border-radius: 0 3px 3px 0;
    user-select: none;
    -webkit-user-select: none;
}

.nextslide {
  right: 0px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="root">
  <button id="modal-opener">Open Modal</button>
</div>
<div id="modal-root">
  <div class="modal">
    <h3>Modal Header</h3>
    <p>Modal contentt</p>
  </div>
<a class="prevslide" >Previous</a><a class="nextslide">Next</a>
</div>

How to use XmlHttpRequest with simple html/js

I have a folder that contains page.html, script.js und info.txt.

My page.html uses the script with <script src="./script.js"></script>; tn and te are ids of an h1 element and a span element respectively.
The content of info.txt is right now simply the word “info” (in UTF-8 as all these files).

In script.js I am trying to reach the content of info.txt with an XmlHttpRequest, as I understand this to be the simplest way.

It is not working and I am trying to troubleshoot what the problem might be.

var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
    if ( this.readyState == 4) {
        if (this.status == 200){
            document.getElementById("tn").innerHTML = xhttp.responseText;
        }
        else if (this.status == 0){
            document.getElementById("tn").innerHTML = "fail";
            document.getElementById("te").innerHTML = xhttp.responseText;
        }
    }
};
xhttp.open("GET", "./info.txt", true);
xhttp.send();

The result is that tn is set to fail and te is completely empty.

Since all files are located in the same folder on my PC I do not think that it is the “same origin problem”.

I am not using ajax or anything like that and I am unsure if I am supposed to set up anything on my PC for XmlHttpRequest to work.

I am using Firefox.

How to create an Angular button that redirects you to a form where one of the inputs has will get filled with text based on the button you click on?

I’ve been trying to build an app where a catalogue component has buttons that redirect me to a form component where the textarea will have an input based on the button that is clicked. For example: "Hello I would like to inquire about your {{product.name}}"

They are sibling components so I have tried doing it like this. I don’t know if this is the best way to do it

Service.ts

import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class ContactTemplateService {

  private productSource = new BehaviorSubject('default text')
  currentProduct = this.productSource.asObservable();

  constructor() { }

  inquiryAboutProduct(name: string) {
    this.productSource.next(name)
  }
}

form html


<body class="bg-light mt-3">
  <div class="container">
    <div class="text-center">
      <h3 class="text-primary">How Can We Help You?</h3>
      <p class="lead mx-3">
        Message us with your questions, we'll reply as soon as possible!
      </p>
    </div>
    <form [formGroup]="contactForm" (ngSubmit)="onSubmit()">
      <div class="d-flex align-items-center justify-content-center">
        <div class="col-md-4">
          <div class="p-4 rounded shadow-md">
            <div class="form-group">
              <label for="name" class="form-label">Your Name</label>
              <input
                type="text"
                name="name"
                class="form-control"
                placeholder="Your Name"
                formControlName="form_name"         
              />
            </div>
            <div class="mt-3 form-group">
              <label for="Email" class="form-label">Your Email</label>
              <input
                name="email"
                class="form-control"
                placeholder="Your Email"
                formControlName="form_email"                
              />
            </div>
            <div class="mt-3 form-group">
              <label for="Subject" class="form-label">Subject</label>
              <input
                type="text"
                name="subject"
                class="form-control"
                placeholder="Subject"
                formControlName="subject"               
                maxlength="50"
              />
            </div>
            <div class="mt-3 mb-3 form-group">
              <label for="Message" class="form-label">Message</label>
              <textarea
                name="message"
                formControlName="message"
                cols="20"
                rows="5"
                class="form-control"
                placeholder="Hi, I would like to inquire about your..."
              ></textarea>
            </div>
            <button class="btn btn-primary" type="submit" [disabled]="!contactForm.valid">Send</button>
          </div>
        </div>
      </div>
    </form>
  </div>
</body>

form component

import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, Validators, ReactiveFormsModule } from '@angular/forms';
import { ContactUsService } from './contact-us.service';

import emailjs from '@emailjs/browser';
import { ContactTemplateService } from './contact-template.service';
import { Subscription } from 'rxjs';



@Component({
  selector: 'app-contact-us',
  templateUrl: './contact-us.component.html',
  styleUrls: ['./contact-us.component.css']
})
  

export class ContactUsComponent implements OnInit {
  productName!: string;
  subscription!: Subscription

  constructor(private fb: FormBuilder, private contact: ContactTemplateService) {}

  ngOnInit(): void {
  }
  

  contactForm = this.fb.group({
    form_name: ['', Validators.required],
    form_email: ['', [Validators.required, Validators.email]],
    subject: ['', Validators.required], 
    message: ['', Validators.required],
  });


  async onSubmit() {
    emailjs.init('PApdcrgYVbBtHuMZe')
    let response = await emailjs.send('service_wpv576e', 'template_pazz7u9', {
      from_name: this.contactForm.value.form_name,
      from_email: this.contactForm.value.form_email,
      subject: this.contactForm.value.subject,
      message: this.contactForm.value.message, 
    });

    alert('Message has been sent')
    this.contactForm.reset();
  }


  inquireProducts(){
    this.subscription = this.contact.currentProduct.subscribe(productName => this.productName = productName)
  }

  

}

catalogue html

<br>
<br>
<br>

<div class="container">
    <h2 class="display-1 d-flex justify-content-center text-center">Tech Products/
        Gadgets</h2>

    <h3 class="display-6 d-flex justify-content-center px-5 text-center">Great option for a long-term gift with a lasting
        impression. Each of these can be customised with
        company logo in the packaging or the product.</h3>
</div>

<br>
<br>

<div class="container">
  <div class="row g-5">
    
    <ng-container *ngFor="let categoryArray of Productinfo">
      <ng-container *ngFor="let product of categoryArray.Tech">
          <div
            class="d-flex justify-content-center col-xxl-3 col-xl-4 col-lg-6 col-12">
            <div class="vstack gap-3">
              <div
              class="card card-cover h-100 overflow-hidden text-white bg-white rounded-5 shadow-lg"
              >
              <img src="{{ product.image }}" style="object-fit: cover" />
              <div
                class="d-flex flex-column ps-3 pe-5 fontName text-light text-shadow-1 h-100"
                style="position: absolute"
              >
                <h2 id="productName"
                  class="pt-5 mt-5 mb-4 display-6 lh-1 fw-bold"
                  style="position: relative"
                >
                  {{ product.name }}
                </h2>
                <img
                  src="../../../assets/images/bonjour-logo.png"
                  alt="Logo"
                  width="32"
                  height="32"
                  class="rounded-circle border border-dark bg-dark"
                  style="position: absolute; bottom: 15px"
                  />
                </div>
              </div>
              <button class="btn btn-dark" value="{{product.name}}" (click)="inquiryRedirect(product.name)" routerLink="/contact" >Inquire about {{product.name}}</button>
            </div>
          </div>
        </ng-container>
      </ng-container>
      
        </div>
      </div>

catalogue component

import { Component, OnInit } from '@angular/core';
import { ContactTemplateService } from 'src/app/shared-components/contact-us/contact-template.service';
import { DataStorageService } from 'src/app/shared/data-storage.service';
import { Product } from 'src/app/shared/product-model';


@Component({
  selector: 'app-catalogue-tech',
  templateUrl: './catalogue-tech.component.html',
  styleUrls: ['./catalogue-tech.component.css']
})
export class CatalogueTechComponent implements OnInit {
  Productinfo: any = []
  ProductValue!: string

  

  constructor(private service: DataStorageService, private contact: ContactTemplateService ) {}


  ngOnInit() {

    this.service.GetProductDetails().subscribe(data => {
      this.Productinfo = data;
    })
      
    

  }

  inquiryRedirect(name: string) {
    this.contact.inquiryAboutProduct(name)
      
    } 

} 

Can anyone help me with this situation

Reference Image

const library = (await(await fetch( ' ./indexData/theLibrary.json')) .json())
const uniquelD = (await(await fetch(• ./indexData/uniqueid .json')).json())

I was trying to load static files like this javascript file using django
But can’t figure out the source of error here, My editor shows no error and this file ran perfectly fine until i added it to django.

Can you please point out what i am missing here

How to get value of property Speaks tuff on Model using jQuery?

I work on asp.net MVC 5 .NET Framework . I face issue I can’t get value of
Property SpeakStuff when Page Load .

on object ResignationRequester property SpeakStuff represent by two check boxes Yes and No .

if SpeakStuff equal True then Yes checkbox will be checked

if SpeakStuff equal False then No checkbox will be checked

so How to do that when page load without user check depend on value on database .

my code as below :

<div> 
@Html.Label("Did You Meet/Speak to Staff", htmlAttributes: new { @class = "control-label col-md-5" })
  <div class="col-md-7">
      <input type="checkbox" id="SpeakStuff" name="SpeakStuff" value="true" class="speak-stuff-checkbox" @(Model.SpeakStuff ? "checked" : "") />
      Yes
      &nbsp;&nbsp;
      <input type="checkbox" id="SpeakStuff" name="SpeakStuff" value="false" class="speak-stuff-checkbox" @(!Model.SpeakStuff ? "checked" : "") />
      No
  </div>
</div>

 $('.speak-stuff-checkbox').on('change', function () {
     $('.speak-stuff-checkbox').not(this).prop('checked', false);
     var selectedValue = $(this).val();
     $('#SpeakStuff').val(selectedValue);
 });
  public class ResignationRequester
  {

   public bool SpeakStuff { get; set; }
  }
[HttpGet]
public async Task<ActionResult> Details(int? id, string msg)
{
  
    ResignationRequester workforceRequest = Workforce.ResignationGetRequestByID((int)id);
   
   //when check workforceRequest.SpeakStuff it will be true or false 
// so How to make check box yes checked when true and checkbox No checked when it False
    return View(workforceRequest);
}

so suppose workforceRequest.SpeakStuff=false then No will checked as Image below :
image for checkbox checked

I have trouble making a canvas take up the full window using HTML5 and JS

I am new to HTML and JS and am trying to code a basic game. However, I keep running into the issue that scroll bars appear, meaning that something is bigger than it should be. I looked into it a bit, and it seems it is the html tag which is too high for the window. I need to know how to fix this.

This is the code I’m using to make it take the whole window (these are the first 3 lines of code):

let canvas = document.getElementById("mainCanvas");
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;

Vanilla js bootstrap layout issue

I am trying to fetch image data from Pixabay api where, I want to show editor’s choice images.
The problem is regarding the layout. I am trying to show 3 or 4 images in each row but the layout is breaking down. I don’t want to compromise with the responsiveness. Please help me.

let editorChoice = document.querySelector('.editorchoice')
async function getImg(){
    let imgData = await fetch('https://pixabay.com/api/?key=37860007-782d282111110936664077067&editors_choice')
   let imgRaw = await imgData.json()
   console.log(imgRaw)
  let itemData = imgRaw.hits
  itemData.map((item) => {
    
    let imgId = item.id 
    let imgType = item.type
    let imgPreview = item.previewURL
    let imgTag = item.tags

    editorChoice.innerHTML += `<div class="col-lg-4 card">
    <img src="${imgPreview}" class="img-responsive center-block" alt="${imgTag}"
    </div>
    <p class="text-center">${imgTag}</p>`

  })

}
getImg()
<div class="container-fluid bg-3 text-center">
  <h3>Editor's Choice</h3><br>
  <div class="editorchoice"></div>
</div>

ReferenceError: window is not defined at new Commerce [email protected]

node.js command prompt

ReferenceError: window is not defined
    at new Commerce (C:Usersandrefinal-exam-react-projectnode_modules@checcommerce.jsdistcommerce.export.js:1:399)
    at eval (webpack-internal:///./lib/commerce.js:8:16)

localhost:3000

Server Error

ReferenceError: window is not defined
This error happened while generating the page. Any console logs will be displayed in the terminal window.
Source

libcommerce.js (3:15) @ eval

  1 | import CommerceSDK from "@chec/commerce.js";
  2 |
> 3 | const client = new CommerceSDK(process.env.NEXT_PUBLIC_CHEC_PUBLIC_API_KEY);
    |               ^
  4 |
  5 | export default client;

I was expecting it to run correctly but I encountered this problem

I have also tried running this on my project but does not seem to solve anything
npm install webpack webpack-cli --save-dev

Why nodemailer does not work in playwright project?

I have implemented a reporter.ts file in my play wright project. I want to send an email to some developers at the end of the running tests. But although I have tried several ways and read the documentation of nodemailer module, but no email is sent, and no error is also shown.

Here is my full code of reporter.ts file:

import { FullConfig, FullResult, Reporter, Suite, TestCase, TestResult, TestStatus, TestError } from "@playwright/test/reporter";
import * as fs from "fs"; // The node:fs module enables interacting with the file system in a way modeled on standard POSIX functions
import date from 'date-and-time';
import nodemailer from "nodemailer";
import cron from "node-cron";
import { spawn } from "child_process";
import { google } from 'googleapis';
import { OAUTH_CLIENTID, 
    OAUTH_CLIENT_SECRET, 
    OAUTH_REFRESH_TOKEN,
    OAUTH_ACCESS_TOKEN,
    REDIRECT_URL } from "./constant/authorization";

/**
 * To run this file use the below command:
 * npx playwright test --reporter=reporter.ts
 */

// Set up Auth2 client
const oAuth2Client = new google.auth.OAuth2(
    OAUTH_CLIENTID,
    OAUTH_CLIENT_SECRET,
    REDIRECT_URL
)

// Set the access token
oAuth2Client.setCredentials({
    access_token: OAUTH_ACCESS_TOKEN,
});

//  Create the transporter using OAuth2 authentication
const transporter = nodemailer.createTransport({
    service: 'gmail',
    host: 'smtp.gmail.com',
    port:  587,
    secure: false,
    auth: {
        type: 'OAuth2',
        user: '[email protected]',
        clientId: OAUTH_CLIENTID,
        clientSecret: OAUTH_CLIENT_SECRET,
        refreshToken: OAUTH_REFRESH_TOKEN,
        accessToken: oAuth2Client.getAccessToken(),
    }
});


class MyReporter implements Reporter {
    modifiedResults: { test: string; status: TestStatus; executionTime: number; errors: TestError[] }[];

    constructor() {
        this.modifiedResults = [];
    }

    onBegin(config: FullConfig<{}, {}>, suite: Suite): void {
        console.log(`Execution of ${suite.allTests().length} tests`);
    }

    onEnd(result: FullResult): void | Promise<void | { status?: "passed" | "failed" | "timedout" | "interrupted" | undefined; } | undefined> {
        console.log(`Execution finished with status of ${result.status}`);

        // this.sendEmail();
        const now = new Date(); // Get the current date and time
        const dateStringFolder = date.format(now, 'YYYY-MM-DD');
        const dateStringFile = date.format(now, 'YYYY-MM-DD-HH');
        const folderPath = `pw_res_${dateStringFolder}`;

        if (!fs.existsSync(folderPath)) {
            fs.mkdirSync(folderPath);
        }
        const formattedResults = this.modifiedResults.map((test) => ({
            title: test.test,
            status: test.status,
            errors: test.errors
        }));
        // console.log(`The formated result is: ${formattedResults}`);

        // Format the test results in a more interpretable way
        const formattedEmailContent = formattedResults
            .map((result) => `Title: ${result.title}nStatus: ${result.status}nErrors: ${result.errors}`)
            .join("nn");
        

        const randomInt = Math.random(); 
        fs.appendFileSync(`${folderPath}/test-result-${dateStringFile}.txt`, formattedEmailContent);

        this.sendEmail();
        console.log("HA HA HA!");
    }

    onTestBegin(test: TestCase, result: TestResult): void {
        console.log(`Execution of ${test.title} started.`);
    }

    onTestEnd(test: TestCase, result: TestResult): void {
        const now = new Date(); // Get the current date and time
        const dateString = date.format(now, 'YYYY-MM-DD_HH-mm-ss'); // Format the date and time into a string

        const execTime = result.duration;

        const data = {
            test: test.title,
            status: result.status,
            executionTime: execTime,
            errors: result.errors
        };
        this.modifiedResults.push(data);
    }

    async sendEmail() {
        console.log(this.modifiedResults);
        // Extract the title and status of each test
        const formattedResults = this.modifiedResults.map((test) => ({
            title: test.test,
            status: test.status
        }));
        // console.log(`The formated result is: ${formattedResults}`);

        // Format the test results in a more interpretable way
        const formattedEmailContent = formattedResults
            .map((result) => `Title: ${result.title}nStatus: ${result.status}`)
            .join("nn");
        
        console.log(`The formated email content is: ${formattedEmailContent}`);

        
        // Compose the email
        const mailOptions = {
            from: "[email protected]",
            to: "[email protected]",
            subject: "PlayWright Test Results",
            text: `Test Results:nn${formattedEmailContent}`
        };
        console.log("---------------- send email ---------------")
        // Send the email
        await transporter.sendMail(mailOptions, (error, info) => {
            if (error) {
                console.error('Error sending email: ', error);
            } else {
                console.log('Email sent: ', info.response);
            }
        });
    };
}

// Export the MyReporter class
module.exports = MyReporter;

The output:

(SepantaEnv) D:ABDALsepantaPlayWright>npx playwright test --reporter=reporter.ts
Execution of 2 tests
Execution of login started.
Execution of failed login started.
Execution finished with status of passed
[
  {
    test: 'failed login',
    status: 'passed',
    executionTime: 6754,
    errors: []
  },
  { test: 'login', status: 'passed', executionTime: 7141, errors: [] }
]
The formated email content is: Title: failed login
Status: passed

Title: login
Status: passed
---------------- send email ---------------
HA HA HA!

(SepantaEnv) D:ABDALsepantaPlayWright>

I will be really grateful for any help, since I am stuck in this problem for about one week.

node js api that get Shopify auth token

Hello I need node express.js api that uses Shopify email and password and return Shopify auth token with the help of this token we upload products from our app to Shopify

Plz help me I need this api.

i want node.js api code that uses Shopify email and password then response Shopify auth token

exceljs how to add formula and format to different sheets

I am just a newbie with exceljs library. I am struggling to add format and formula on different sheets simultaneously. I will elaborate a little more:

I am using Excel to generate sort of an entry Excel file where the user will be able to write to that Excel workbook in different sheets. Thus, for populating some formulas. The issue is in terms of entering dates. In Excel, when you enter a date like 2012-12-12, it automatically changes to something like 12/12/12 in that cell, which is fine for now, according to my user case. But when I apply the following formula:

const formula = `IF(ISBLANK('sheet 2'!$${letter}$${row}), "", 'sheet 2'!$${letter}$${row});`
 for (let row = 2; row <= 1000; row++) {
    const formula = `IF(ISBLANK('sheet 2'!$${letter}$${row}), "", 'sheet 2'!$${letter}$${row})`;
    const cell = sheet3.getCell(row, col + 1);
    cell.value = {
     formula: formula
    };
 } 

This 12/12/12 will be something like 41255.

Is there a way I can keep this formula but at the same time copy exactly what is type/entered in the sheet1 to sheet 3.

Thanks,