Pycharm初识JS

目录

1 Pycharm上安装相关plugins

2 下载安装 Nodejs

3 查看是否安装成功

3, 用Pycharm新建 JS案例


1 Pycharm上安装相关plugins

File------->Settings------->>>

Pycharm初识JS_第1张图片

Pycharm初识JS_第2张图片

选择其中一个安装。

2 下载安装 Nodejs

Download | Node.js

下载对应的版本安装即可。

3 查看是否安装成功

Windows + R======> cmd ======> 

Pycharm初识JS_第3张图片

3, 用Pycharm新建 JS案例

//'use strict';

function binary_search(list, item) {
  let low = 0;
  let high = list.length - 1;

  while (low <= high) {
    let mid = Math.floor((low + high) / 2);
    let guess = list[mid];
    if (guess === item) {
      return mid;
    }
    if (guess > item) {
      high = mid - 1;
    } else {
      low = mid + 1;
    }
  }

  return null;
}

const my_list = [1, 3, 5, 7, 9];

console.log(binary_search(my_list, 3)); // 1
console.log(binary_search(my_list, -1)); // null

你可能感兴趣的:(Java/JavaScript,pycharm,python)